[issue17909] Autodetecting JSON encoding

Martin Panter report at bugs.python.org
Mon Oct 27 02:06:14 CET 2014


Martin Panter added the comment:

If you adjusted the detect_encoding() logic according to Pete Cordell’s table at the bottom of <http://www.ietf.org/mail-archive/web/json/current/msg01959.html>, it might work for standalone strings.

However since the RFC encourages UTF-8 for best interoperability, I wonder if any of this autodetection is necessary. It might be simpler to just assume UTF-8, or use the “utf-8-sig” codec. Or are there real cases where detecting UTF-16 or -32 would be useful?

----------

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


More information about the Python-bugs-list mailing list