I have this code:
keys_file = open("keys.json")
keys = keys_file.read().encode('utf-8')
keys_json = json.loads(keys)
print(keys_json)
There are some none-english characters in keys.json. But as a result I get:
[{'category': 'мбт', 'keys': ['Блендер Philips',
'мультиварка Polaris']}, {'category': 'КБТ', 'keys':
['холод ильник атлант', 'посудомоечная
машина Bosch']}]
what do I do?
utf-8encoding. Is that the encoding of the file?locale.getpreferredencoding()returns) is what I should have said. Additionally I wasn't really advocating that OP calldecode, I wanted to point out that they're doing the logically wrong operation to begin with.