commit 24596c02c86a0453c59485f8b0031279803f1581 Author: Yuwei Yu Date: Sun Oct 2 11:53:53 2011 +0800 add some key for translit; fix #1318 diff --git a/engine/tabcreatedb.py b/engine/tabcreatedb.py index e683c41..5b4a359 100644 --- a/engine/tabcreatedb.py +++ b/engine/tabcreatedb.py @@ -124,10 +124,10 @@ def main (): _gouci = [] patt_com = re.compile(r'^###.*') patt_blank = re.compile(r'^[ \t]*$') - patt_conf = re.compile(r'.*=.*') - patt_table = re.compile(r' *([^\s]+) *\t *([^\s]+)\t *[^\s]+ *') - patt_gouci = re.compile(r' *[^\s]+ *\t *[^\s]+ *') - patt_s = re.compile(r' *([^\s]+) *\t *([\x00-\xff]{3}) *\t *[^\s]+ *') + patt_conf = re.compile(r'[^\t]*=[^\t]*') + patt_table = re.compile(r' *([^\s]+) *\t *([^\s]+)\t *[^\s]+ *$') + patt_gouci = re.compile(r' *[^\s]+ *\t *[^\s]+ *$') + patt_s = re.compile(r' *([^\s]+) *\t *([\x00-\xff]{3}) *\t *[^\s]+ *$') for l in f: if ( not patt_com.match(l) ) and ( not patt_blank.match(l) ): diff --git a/engine/tabdict.py b/engine/tabdict.py index 368734d..8650fe4 100644 --- a/engine/tabdict.py +++ b/engine/tabdict.py @@ -25,6 +25,12 @@ import sys reload (sys) sys.setdefaultencoding('utf-8') +def gen_uni(the_string): + """ + call unicode to convert utf-8 to unicode in py, just for convenience. + """ + return unicode(the_string, 'utf-8') + tab_dict = { '0':0, 'a':1, 'b':2, 'c':3, 'd':4, 'e':5, @@ -45,7 +51,11 @@ tab_dict = { 'R':76, 'S':77, 'T':78, 'U':79, 'V':80, 'W':81, 'X':82, 'Y':83, 'Z':84, '0':85, '1':86, '2':87, '3':88, '4':89, '5':90, - '6':91, '7':92, '8':93, '9':94 + '6':91, '7':92, '8':93, '9':94, + # for translit + gen_uni('ä'):95, + gen_uni('ö'):96, + gen_uni('ü'):97 } tab_key_list = tab_dict.keys()