fixes #8768 properly
This commit is contained in:
parent
e98e214422
commit
dfdf8e58c7
3 changed files with 18 additions and 17 deletions
|
|
@ -1,26 +1,30 @@
|
||||||
#! usr/bin/env python
|
#! usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Generates the unidecode.dat module
|
# Generates the unidecode.dat module
|
||||||
# (c) 2010 Andreas Rumpf
|
# (c) 2010 Andreas Rumpf
|
||||||
|
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
import warnings
|
try:
|
||||||
|
import warnings
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
def main2():
|
def main2():
|
||||||
data = []
|
f = open("unidecode.dat", "wb+")
|
||||||
for x in range(128, 0xffff + 1):
|
for x in range(128, 0xffff + 1):
|
||||||
u = eval("u'\\u%04x'" % x)
|
u = eval("u'\\u%04x'" % x)
|
||||||
|
|
||||||
val = unidecode(u)
|
val = unidecode(u)
|
||||||
data.append(val)
|
|
||||||
|
|
||||||
f = open("unidecode.dat", "w+")
|
# f.write("%x | " % x)
|
||||||
for d in data:
|
if x==0x2028: # U+2028 = LINE SEPARATOR
|
||||||
f.write("%s\n" % d)
|
val = ""
|
||||||
|
elif x==0x2029: # U+2028 = PARAGRAPH SEPARATOR
|
||||||
|
val = ""
|
||||||
|
f.write("%s\n" % val)
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
main2()
|
main2()
|
||||||
|
|
@ -8110,9 +8110,6 @@ _
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%0
|
%0
|
||||||
%00
|
%00
|
||||||
'
|
'
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,6 @@ proc unidecode*(s: string): string =
|
||||||
elif c <% translationTable.len: add(result, translationTable[c-128])
|
elif c <% translationTable.len: add(result, translationTable[c-128])
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
loadUnidecodeTable("lib/pure/unidecode/unidecode.dat")
|
#loadUnidecodeTable("lib/pure/unidecode/unidecode.dat")
|
||||||
doAassert unidecode("Äußerst") == "Ausserst"
|
doAssert unidecode("Äußerst") == "Ausserst"
|
||||||
doAssert unidecode("北京") == "Bei Jing"
|
doAssert unidecode("北京") == "Bei Jing "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue