aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/GenerateCaseConvert.py
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-08-01 09:40:57 +1000
committerNeil <nyamatongwe@gmail.com>2013-08-01 09:40:57 +1000
commitb0c0e57a6bf5fa754e7a18bf54bf79e2580fdf18 (patch)
tree57074441d2a56b4f2b4ab7ee78071a66ebeae073 /scripts/GenerateCaseConvert.py
parent7b996c0c3f29c7ab47eef1ae9d398337fddcdeaa (diff)
downloadscintilla-mirror-b0c0e57a6bf5fa754e7a18bf54bf79e2580fdf18.tar.gz
Bug [#1506]. In some locales Visual C++ fails with UTF-8 in string literals.
Fixed by using hex escapes for non-ASCII.
Diffstat (limited to 'scripts/GenerateCaseConvert.py')
-rw-r--r--scripts/GenerateCaseConvert.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/GenerateCaseConvert.py b/scripts/GenerateCaseConvert.py
index 841cdcc51..bcf49236f 100644
--- a/scripts/GenerateCaseConvert.py
+++ b/scripts/GenerateCaseConvert.py
@@ -101,6 +101,9 @@ def groupRanges(symmetrics):
return rangeGroups, nonRanges
+def escape(s):
+ return "".join((chr(c) if chr(c) in string.ascii_letters else "\\x%x" % c) for c in s.encode('utf-8'))
+
def updateCaseConvert():
symmetrics, complexes = conversionSets()
@@ -114,7 +117,7 @@ def updateCaseConvert():
print(len(symmetrics), "symmetric")
- complexLines = ['"%s|%s|%s|%s|"' % x for x in complexes]
+ complexLines = ['"%s|%s|%s|%s|"' % tuple(escape(t) for t in x) for x in complexes]
print(len(complexLines), "complex")
Regenerate("../src/CaseConvert.cxx", "//", rangeLines, nonRangeLines, complexLines)