I try to edit a json file (encoded in utf-8, says notepad++), but all the french accent inside are destroyed doing it. I cannot find any help with this problem on internet, could somebody help me ? Getting a little crazy..
my json file is test.json and it has only one line : {"old": "bât_1"}
I try :
# -*- coding: utf-8 -*-
import json
newdict = {'new':'bât_2'}
with open('test.json') as inputdata:
data = json.load(inputdata, encoding = 'utf-8')
data.update(newdict)
with open('test.json', 'w', encoding = 'utf-8') as fid:
json.dump(data, fid)
and if I open again test.json, I get: {"old": "b\u00c3\u00a2t_1", "new": "b\u00e2t_2"}
Thank you for any help