Antoine Pitrou added the comment:

Still, JSON itself is not a wire protocol; HTTP is. http://www.json.org states 
that "JSON is a text format" and the grammar description talks "UNICODE 
characters", not bytes. The ECMA spec states that "JSON text is a sequence of 
Unicode code points".

RFC 4627 is a bit more affirmative, though, and says that "JSON text SHALL be 
encoded in Unicode [sic]. The default encoding is UTF-8".

Related issues:
- issue #10976: json.loads() raises TypeError on bytes object
- issue #17909 (+ patch!): autodetecting JSON encoding

> The other simple solution would be to add <name>b variants of the affected 
> APIs.

"dumpb" is not very pretty and can easily be misread as "dumb" :-)
"dump_bytes" looks better to me.

----------
nosy: +pitrou

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19837>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to