2 # -*- coding: koi8-r -*-
5 # Rus -> Lat transliteration (koi2lat and win2lat)
75 def make_xxx2lat(encoding="cp1251"):
77 for k, v in koi2lat_d.items():
78 k = unicode(k, "koi8-r").encode(encoding)
83 from m_lib.lazy.dict import LazyDictInitFunc
84 win2lat_d = LazyDictInitFunc(make_xxx2lat, encoding="cp1251")
87 def rus2lat(instr, rus2lat_d = koi2lat_d):
90 out.append(rus2lat_d.get(c, c))
97 return rus2lat(instr, win2lat_d)
100 if __name__ == "__main__":
101 Test = "Щербаков Игорь Григорьевич. АБВ xyz абв ЬЬЭЮЯ ъьэюя"
103 print "Тест:", koi2lat(Test)
104 print "Тест:", win2lat(unicode(Test, "koi8-r").encode("cp1251"))