[issue21194] json.dumps with ensure_ascii=False doesn't escape control characters

akira report at bugs.python.org
Thu Apr 10 20:40:58 CEST 2014


akira added the comment:

json.dumps works correctly in this case.

Both json/application rfc [1] and ecma json standard [2] say:

> All characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark (U+0022), reverse solidus (U+005C), and the control characters (U+0000 through U+001F).

i.e., only a subset (00-1F) of control characters must be escaped in json string

[1]: https://tools.ietf.org/html/rfc7159#section-7
[2]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

----------
nosy: +akira

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


More information about the Python-bugs-list mailing list