[issue11489] json.dumps not parsable by json.loads (on Linux only)

Taras Prokopenko report at bugs.python.org
Wed Oct 16 21:05:33 CEST 2013


Taras Prokopenko added the comment:

You should use ensure_ascii=False option to json.dumps, ie

import json
unicode_bytes = '\xed\xa8\x80'
unicode_string = unicode_bytes.decode("utf8")
json_encoded = json.dumps(unicode_string, ensure_ascii=False)

json.loads(json_encoded),unicode_string
(u'\uda00', u'\uda00')
cmp(json.loads(json_encoded),unicode_string)
0

----------
nosy: +Taras.Prokopenko

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11489>
_______________________________________


More information about the Python-bugs-list mailing list