summaryrefslogtreecommitdiff
path: root/simplejson
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-03-29 07:11:32 +0100
committerRichard van der Hoff <richard@matrix.org>2018-03-29 07:11:32 +0100
commit8ea5f90e6eadcf6a1ce4bb3908e954f7253aa3ae (patch)
treeb241796823fc2eec3b0cc85afbabdf7090b7510f /simplejson
parent05b8f6dfdfcf49cc1f7ebf8bbb38b7be274ad40f (diff)
downloadsimplejson-8ea5f90e6eadcf6a1ce4bb3908e954f7253aa3ae.tar.gz
Improve docstring on JSONEncoderForHTML
Document the U+2028 and U+2029 behavior.
Diffstat (limited to 'simplejson')
-rw-r--r--simplejson/encoder.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index faf87a8..470ea84 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -379,6 +379,11 @@ class JSONEncoderForHTML(JSONEncoder):
characters &, < and > should be escaped. They cannot be escaped
with the usual entities (e.g. &amp;) because they are not expanded
within <script> tags.
+
+ This class also escapes the line separator and paragraph separator
+ characters U+2028 and U+2029, irrespective of the ensure_ascii setting,
+ as these characters are not valid in Javascript strings (see
+ http://timelessrepo.com/json-isnt-a-javascript-subset).
"""
def encode(self, o):