Antoine Pitrou added the comment:

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)

----------

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

Reply via email to