2 # -*- coding: koi8-r -*-
5 # Rus -> Lat transliteration (koi2lat and win2lat)
6 # Written by Broytman. Copyright (C) 1997-2002 PhiloSoft Design
76 def make_xxx2lat(encoding="cp1251"):
78 for k, v in koi2lat_d.items():
79 k = unicode(k, "koi8-r").encode(encoding)
84 from m_lib.lazy.dict import LazyDictInitFunc
85 win2lat_d = LazyDictInitFunc(make_xxx2lat, encoding="cp1251")
88 def rus2lat(instr, rus2lat_d = koi2lat_d):
91 out.append(rus2lat_d.get(c, c))
98 return rus2lat(instr, win2lat_d)
101 if __name__ == "__main__":
102 Test = "Щербаков Игорь Григорьевич. АБВ xyz абв ЬЬЭЮЯ ъьэюя"
104 print "Тест:", koi2lat(Test)
105 print "Тест:", win2lat(unicode(Test, "koi8-r").encode("cp1251"))