diff options
-rw-r--r-- | lib/pure/unidecode/gen.py | 26 | ||||
-rw-r--r-- | lib/pure/unidecode/unidecode.dat | 3 | ||||
-rw-r--r-- | lib/pure/unidecode/unidecode.nim | 6 |
3 files changed, 18 insertions, 17 deletions
diff --git a/lib/pure/unidecode/gen.py b/lib/pure/unidecode/gen.py index 33f1c799f..f0647ea6c 100644 --- a/lib/pure/unidecode/gen.py +++ b/lib/pure/unidecode/gen.py @@ -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.close() + # 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() \ No newline at end of file diff --git a/lib/pure/unidecode/unidecode.dat b/lib/pure/unidecode/unidecode.dat index 37b66bedf..5f4c075d8 100644 --- a/lib/pure/unidecode/unidecode.dat +++ b/lib/pure/unidecode/unidecode.dat @@ -8109,9 +8109,6 @@ _ - - - %0 %00 diff --git a/lib/pure/unidecode/unidecode.nim b/lib/pure/unidecode/unidecode.nim index 771975412..e0b8d3946 100644 --- a/lib/pure/unidecode/unidecode.nim +++ b/lib/pure/unidecode/unidecode.nim @@ -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 " |