Tom Christie added the comment:

> But only if you use non-ascii in the binary input, in which case you get an 
> encoding error, which is a correct error.

Kind of, except that this (python 2.7) works just fine:

    >>> data = {'snowman': '☃'}
    >>> json.dumps(data, ensure_ascii=False)
    '{"snowman": "\xe2\x98\x83"}'

Whereas this raises an exception:

    >>> json.dumps(data, separators=(u':', u','), ensure_ascii=False)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1: 
ordinal not in range(128)

If it was the same in both cases then I wouldn't consider it a problem.
As it is, introducing the `seperators` parameter changes the behaviour.

Anyways, I'll get off my high horse now. :)

----------

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

Reply via email to