Author pitrou
Recipients bob.ippolito, ezio.melotti, pitrou, rhettinger, serhiy.storchaka
Date 2013-05-04.15:59:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367683172.02.0.258713299528.issue17906@psf.upfronthosting.co.za>
In-reply-to
Content
I wonder if json should simply be less strict by default. If you pass the raw unescaped character, the json module accepts it:

>>> json.loads('{"a": "\ud8e9"}')
{'a': '\ud8e9'}

It's only if you pass the escaped representation that json rejects it:

>>> json.loads('{"a": "\\ud8e9"}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/antoine/cpython/default/Lib/json/__init__.py", line 316, in loads
    return _default_decoder.decode(s)
  File "/home/antoine/cpython/default/Lib/json/decoder.py", line 344, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/antoine/cpython/default/Lib/json/decoder.py", line 360, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Unpaired high surrogate: line 1 column 9 (char 8)
History
Date User Action Args
2013-05-04 15:59:32pitrousetrecipients: + pitrou, rhettinger, bob.ippolito, ezio.melotti, serhiy.storchaka
2013-05-04 15:59:32pitrousetmessageid: <1367683172.02.0.258713299528.issue17906@psf.upfronthosting.co.za>
2013-05-04 15:59:32pitroulinkissue17906 messages
2013-05-04 15:59:31pitroucreate