[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2015-02-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22701 ___ ___

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-12-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Looks either you have opened a file with the backslashreplace error handler or ran Python with PYTHONIOENCODING which sets the backslashreplace error handler. -- nosy: +serhiy.storchaka status: open - pending ___

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-10-31 Thread Ezio Melotti
Ezio Melotti added the comment: The example works for me with both python 2 and 3. I'm going to close this in a while if OP doesn't reply. $ python2 -c import json; json.dump({'name': '港区'}, open('py2.json', 'w'), indent=4, separators=(',', ': '), ensure_ascii=False) cat py2.json {

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-10-31 Thread Michael Kuss
Michael Kuss added the comment: Pardon the delay - this json dump function is embedded in a much larger script, so it took some untangling to get it running on Python 3.3, and scrub some personal identifying info from it. This script also does not work in Python 3.3: File

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-10-31 Thread R. David Murray
R. David Murray added the comment: That error message indicates you've opened the output file in binary mode instead of text mode. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22701 ___

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-10-22 Thread Michael Kuss
New submission from Michael Kuss: When running the following: json.dump(['name': 港区], myfile.json, indent=4, separators=(',', ': '), ensure_ascii=False) the function escapes the unicode, even though I have explicitly asked to not force to ascii: \u6E2F\u533A By changing __init__.py such

[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-10-22 Thread R. David Murray
R. David Murray added the comment: If I fix your example so it runs: json.dump({'name': 港区}, open('myfile.json', 'w'), indent=4, separators=(',', ': '), ensure_ascii=False) I get the expected output: rdmurray@pydev:~/python/p34cat myfile.json { name: 港区 } That example won't work in