Message159391
Le jeudi 26 avril 2012 à 15:48 +0000, Serhiy Storchaka a écrit :
>
> I mean a string that starts with '\u0000'. b'"\x00...'.
According to the RFC, that should be escaped:
All Unicode characters may be placed within the
quotation marks except for the characters that must be escaped:
quotation mark, reverse solidus, and the control characters (U+0000
through U+001F).
And indeed:
>>> json.loads('"\u0000"')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/antoine/opt/lib/python3.2/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/home/antoine/opt/lib/python3.2/json/decoder.py", line 351, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/antoine/opt/lib/python3.2/json/decoder.py", line 367, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid control character at: line 1 column 1 (char 1)
>>> json.loads('"\\u0000"')
'\x00' |
|
Date |
User |
Action |
Args |
2012-04-26 16:12:45 | pitrou | set | recipients:
+ pitrou, barry, georg.brandl, hhas, ezio.melotti, eric.araujo, r.david.murray, docs@python, antlong, serhiy.storchaka, Balthazar.Rouberol |
2012-04-26 16:12:45 | pitrou | set | messageid: <1335456765.14.0.898384239606.issue10976@psf.upfronthosting.co.za> |
2012-04-26 16:12:44 | pitrou | link | issue10976 messages |
2012-04-26 16:12:44 | pitrou | create | |
|