international coding - SOLUTION
Jaros³aw Zabie³³o (delete .PL)
webmaster at apologetyka.com.pl
Fri May 3 06:35:31 EDT 2002
I have a solution for every coding. Look at my piece of Python code:
import codecs
utf8Txt = u"""a\u0105 c=\u0107 e\u0119 l\u0142 n\u0144 o\xf3 s\u015b
z\u017c x\u017a"""
# from utf-8 to cp1250:
winTxt = utf8Txt.encode('cp1250')
# from utf-8 to iso-8859-2:
linuxTxt = utf8Txt.encode('iso-8859-2')
# from utf-8 to mac-latin2:
macTxt = utf8Txt.encode('mac-latin2')
# from mac-latin2 to utf-8:
utf8Txt2= unicode(macTxt, 'mac-latin2')
# from iso-8859-2 to cp1250:
winTxt = unicode(linuxTxt, 'iso-8859-2').encode('cp1250)')
# check:
for c in winTxt: print c,
Python rulez. :)
--
Jarosław Zabiełło (UIN: 6712522)
URL: http://3585753410/~zbiru
More information about the Python-list
mailing list