Skip to content

Commit

Permalink
Fix collation escaping, removing double backslash (unicode-org#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-oly authored Mar 5, 2024
1 parent 96a46e5 commit 33c9564
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions testgen/generators/collation_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,11 @@ def parseCollTestData(self, testdata):
return "".join(return_list)

def stringifyCode(self, cp):
# Converts some code points represented as hex strings to escaped values, others as characters
if cp < 0x20 or cp == 0x22 or cp == 127 or cp == 0x5C:
teststring = "\\u" + format(cp, "04x")
else:
try:
teststring = chr(cp)
except ValueError as err:
teststring = cp
# Just include character and escaping will work in JSONification
try:
teststring = chr(cp)
except ValueError as err:
teststring = cp

return teststring

Expand Down

0 comments on commit 33c9564

Please sign in to comment.