pystache

Python dump json with accents [duplicate]

和自甴很熟 提交于 2020-05-12 11:46:41
问题 This question already has answers here : Saving utf-8 texts in json.dumps as UTF8, not as \u escape sequence (12 answers) Closed 5 years ago . How can i print a json with special characters as "à" or "ç"? I can print like this: import json weird_dict ={"person": "ç", "á": 'à', "ç": 'ã'} print json.dumps(weird_dict, indent=4, sort_keys=True) output: { "person": "\u00e7", "\u00e1": "\u00e0", "\u00e7": "\u00e3" } if i use 'ensure_ascii=False' weird_dict={"person": "ç", "á": 'à', "ç": 'ã'} print

Python dump json with accents [duplicate]

放肆的年华 提交于 2020-05-12 11:45:08
问题 This question already has answers here : Saving utf-8 texts in json.dumps as UTF8, not as \u escape sequence (12 answers) Closed 5 years ago . How can i print a json with special characters as "à" or "ç"? I can print like this: import json weird_dict ={"person": "ç", "á": 'à', "ç": 'ã'} print json.dumps(weird_dict, indent=4, sort_keys=True) output: { "person": "\u00e7", "\u00e1": "\u00e0", "\u00e7": "\u00e3" } if i use 'ensure_ascii=False' weird_dict={"person": "ç", "á": 'à', "ç": 'ã'} print