summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-15 08:19:55 +0200
committerGeorg Brandl <georg@python.org>2014-10-15 08:19:55 +0200
commit305f4af94739222fdaaeb06a81de9927d7fd2964 (patch)
tree029a0e5a569a27fb751cc1c34c449c9db4684b83 /pygments
parent02d812930d90c3e20a056796d182bf1ce80d24cd (diff)
downloadpygments-305f4af94739222fdaaeb06a81de9927d7fd2964.tar.gz
unistring: fix generated Cs category on Py2.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/unistring.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pygments/unistring.py b/pygments/unistring.py
index 183f088f..2e4eaed6 100644
--- a/pygments/unistring.py
+++ b/pygments/unistring.py
@@ -21,7 +21,7 @@ Cn = u'\u0378-\u0379\u037f-\u0383\u038b\u038d\u03a2\u0528-\u0530\u0557-\u0558\u0
Co = u'\ue000-\uf8ff\U000f0000-\U000ffffd\U00100000-\U0010fffd'
try:
- Cs = eval(r"'\ud800-\udbff\\\udc00\udc01-\udfff'")
+ Cs = eval(r"u'\ud800-\udbff\\\udc00\udc01-\udfff'")
except UnicodeDecodeError:
Cs = '' # Jython can't handle isolated surrogates
@@ -155,9 +155,9 @@ if __name__ == '__main__':
# Jython can't handle isolated surrogates
f.write("""\
try:
- Cs = eval(r"%s")
+ Cs = eval(r"u%s")
except UnicodeDecodeError:
- Cs = '' # Jython can't handle isolated surrogates\n\n""" % repr(val).lstrip('u'))
+ Cs = '' # Jython can't handle isolated surrogates\n\n""" % ascii(val))
else:
f.write('%s = u%a\n\n' % (cat, val))
f.write('cats = %r\n\n' % sorted(categories))