Author Tom.Christie
Recipients Tom.Christie, georg.brandl, r.david.murray
Date 2014-10-30.19:38:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414697907.24.0.730774901941.issue22767@psf.upfronthosting.co.za>
In-reply-to
Content
> 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. :)
History
Date User Action Args
2014-10-30 19:38:27Tom.Christiesetrecipients: + Tom.Christie, georg.brandl, r.david.murray
2014-10-30 19:38:27Tom.Christiesetmessageid: <1414697907.24.0.730774901941.issue22767@psf.upfronthosting.co.za>
2014-10-30 19:38:27Tom.Christielinkissue22767 messages
2014-10-30 19:38:27Tom.Christiecreate