fixes #8768 properly

This commit is contained in:
Araq
2018-08-30 16:54:03 +02:00
parent e98e214422
commit dfdf8e58c7
3 changed files with 18 additions and 17 deletions

View File

@@ -1,26 +1,30 @@
#! usr/bin/env python
#! usr/bin/env python3
# -*- coding: utf-8 -*-
# Generates the unidecode.dat module
# (c) 2010 Andreas Rumpf
from unidecode import unidecode
import warnings
warnings.simplefilter("ignore")
try:
import warnings
warnings.simplefilter("ignore")
except ImportError:
pass
def main2():
data = []
f = open("unidecode.dat", "wb+")
for x in range(128, 0xffff + 1):
u = eval("u'\\u%04x'" % x)
val = unidecode(u)
data.append(val)
f = open("unidecode.dat", "w+")
for d in data:
f.write("%s\n" % d)
# f.write("%x | " % x)
if x==0x2028: # U+2028 = LINE SEPARATOR
val = ""
elif x==0x2029: # U+2028 = PARAGRAPH SEPARATOR
val = ""
f.write("%s\n" % val)
f.close()
main2()
main2()

View File

@@ -8109,9 +8109,6 @@ _
%0
%00

View File

@@ -68,6 +68,6 @@ proc unidecode*(s: string): string =
elif c <% translationTable.len: add(result, translationTable[c-128])
when isMainModule:
loadUnidecodeTable("lib/pure/unidecode/unidecode.dat")
doAassert unidecode("Äußerst") == "Ausserst"
doAssert unidecode("北京") == "Bei Jing"
#loadUnidecodeTable("lib/pure/unidecode/unidecode.dat")
doAssert unidecode("Äußerst") == "Ausserst"
doAssert unidecode("北京") == "Bei Jing "