I apologize if this question has been asked earlier. I am still not clear about encoding in python3.2.
I am reading a csv(encoded in UTF-8 w/o BOM) and I have French accents in the csv.
Here is the code to opening and reading the csv file:
csvfile = open(in_file, 'r', encoding='utf-8')
fieldnames = ("id","locale","message")
reader = csv.DictReader(csvfile,fieldnames,escapechar="\\")
for row in reader:
if row['id'] == id and row['locale'] == locale:
out = row['message'];
I am returning the message(out) as Json
jsonout = json.dumps(out, ensure_ascii=True)
return HttpResponse(jsonout,content_type="application/json; encoding=utf-8")
However when I preview the result I get the accent e(French) being replaced by \u00e9 .
Can you please advice on what I am doing wrong and what should I do so that the json output shows the proper e with accent.
Thanks