summaryrefslogtreecommitdiff
path: root/simplejson/encoder.py
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2013-01-11 09:06:01 -0800
committerBob Ippolito <bob@redivi.com>2013-01-11 09:06:01 -0800
commit9b30e089d1e346b533dea12f6dd28c5e200af057 (patch)
treed4af47f8294c3493af00877bb972e9c952ab7fdb /simplejson/encoder.py
parent88186b0b91343fed6d22e45b940ebd7f7e58f703 (diff)
downloadsimplejson-9b30e089d1e346b533dea12f6dd28c5e200af057.tar.gz
v3.0.6, fixes ensure_ascii=False regression (#50)v3.0.6
Diffstat (limited to 'simplejson/encoder.py')
-rw-r--r--simplejson/encoder.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index 432838b..db5c946 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -15,7 +15,10 @@ c_encode_basestring_ascii, c_make_encoder = _import_speedups()
from simplejson.decoder import PosInf
-ESCAPE = re.compile(u(r'[\x00-\x1f\\"\b\f\n\r\t\u2028\u2029]'))
+#ESCAPE = re.compile(ur'[\x00-\x1f\\"\b\f\n\r\t\u2028\u2029]')
+# This is required because u() will mangle the string and ur'' isn't valid
+# python3 syntax
+ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {