Using Flask's jsonify displays é as é
You're viewing the representation of the dumped data. Since you've disabled JSON_AS_ASCII
, you get two UTF-8 bytes rather than an ASCII-compatible Unicode escape. JSON is still UTF-8, regardless of which representation you choose, but it is typically safer to stick with the default.
Whatever you're using to view the data is misinterpreting the bytes as Latin-1, not UTF-8. Tell whatever you're viewing the data with that it's UTF-8, and it will look correct. Load the data from JSON and you will see that it is still correct.
from flask import Flask, jsonify, jsonapp = Flask('example')app.config['JSON_AS_ASCII'] = True # defaultwith app.app_context(): print(jsonify('é').data) # b'"\\u00e9"\n', Unicode escapeapp.config['JSON_AS_ASCII'] = Falsewith app.app_context(): print(jsonify('é').data) # b'"\xc3\xa9"\n', UTF-8 bytes# you're viewing the bytes as Latin-1print(b'\xc3\xa9'.decode('latin1')) # é# but it's UTF-8print(b'\xc3\xa9'.decode('utf8')) # é# JSON is always UTF-8print(json.loads(b'"\\u00e9"\n') # éprint(json.loads(b'"\xc3\xa9"\n') # é