I am working on a json file with Chinese words in it. I try to read it in my machine with Python, but the Chinese characters just can't be correctly displayed. Here is the json file(a.json):
{
"squadName": "哈囉",
"homeTown": "Metro City",
"formed": 2016,
"secretBase": "Super tower",
"active": true
}
Here is my code:
import json
storage = []
with open('a.json', 'r', encoding='utf-8') as f:
data = json.load(f)
print(data)
Here is the output:
{'squadName': '���o', 'homeTown': 'Metro City', 'formed': 2016, 'secretBase': 'Super tower', 'active': True}
Everything works properly except for the Chinese characters Does anyone know how to fix it?
I've searched so many solutions and I also set the 'encoding' parameter to utf-8
or utf-8-sig
, but it still not working.