homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients Balthazar.Rouberol, antlong, barry, docs@python, eric.araujo, ezio.melotti, georg.brandl, hhas, pitrou, r.david.murray, serhiy.storchaka
Date 2012年04月26日.16:12:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335456765.14.0.898384239606.issue10976@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2012年04月26日 16:12:45pitrousetrecipients: + pitrou, barry, georg.brandl, hhas, ezio.melotti, eric.araujo, r.david.murray, docs@python, antlong, serhiy.storchaka, Balthazar.Rouberol
2012年04月26日 16:12:45pitrousetmessageid: <1335456765.14.0.898384239606.issue10976@psf.upfronthosting.co.za>
2012年04月26日 16:12:44pitroulinkissue10976 messages
2012年04月26日 16:12:44pitroucreate

AltStyle によって変換されたページ (->オリジナル) /