Martin Panter added the comment:

According to that RFC section, the forward solidus is allowed to be in an 
escape sequence, but it is also allowed unescaped:

β€œ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).”

. . .

unescaped = %x20-21 / %x23-5B / %x5D-10FFFF

In general, escaping the forward solidus is not needed, and is easier to read. 
Apparently this escaping is a workaround for embedding JSON inside a HTML 
<script> element, where the sequence β€œ</” is not allowed, and HTML itself does 
not allow escaping: <http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.2>. 
In that case, JSON like {markup: "<i>italic<\/i>"} would be escaped, but most 
cases still do not need escaping, such as {url: "http://example.net/"}.

----------
nosy: +vadmium

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

Reply via email to