2 # -*- coding: koi8-r -*-
4 from __future__ import print_function
7 # Rus -> Lat transliteration (koi2lat and win2lat)
77 def make_xxx2lat(encoding="cp1251"):
79 for k, v in koi2lat_d.items():
80 k = unicode(k, "koi8-r").encode(encoding)
85 from m_lib.lazy.dict import LazyDictInitFunc
86 win2lat_d = LazyDictInitFunc(make_xxx2lat, encoding="cp1251")
89 def rus2lat(instr, rus2lat_d = koi2lat_d):
92 out.append(rus2lat_d.get(c, c))
99 return rus2lat(instr, win2lat_d)
102 if __name__ == "__main__":
103 Test = "Щербаков Игорь Григорьевич. АБВ xyz абв ЬЬЭЮЯ ъьэюя"
105 print("Тест:", koi2lat(Test))
106 print("Тест:", win2lat(unicode(Test, "koi8-r").encode("cp1251")))