diff options
Diffstat (limited to 'pygments/unistring.py')
-rw-r--r-- | pygments/unistring.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pygments/unistring.py b/pygments/unistring.py index e79e143e..06cb9560 100644 --- a/pygments/unistring.py +++ b/pygments/unistring.py @@ -108,9 +108,12 @@ if __name__ == '__main__': for code in range(65535): c = unichr(code) cat = unicodedata.category(c) - # Hack to avoid combining this combining with the preceeding high - # surrogate, 0xdbff, when doing a repr. if ord(c) == 0xdc00: + # Hack to avoid combining this combining with the preceeding high + # surrogate, 0xdbff, when doing a repr. + c = u'\\' + c + elif ord(c) in (0x2d, 0x5c): + # Escape backslash itself and dash. c = u'\\' + c categories.setdefault(cat, []).append(c) |