changing string encoding to different charset?

Daniel Woodhouse wodemoneke at
Sun Dec 14 15:21:16 CET 2008

Is it possible to re-encode a string to a different character set in
python?  To be more specific, I want to change a text file encoded in
windows-1251 to UTF-8.
I've tried using string.encode, but get the error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 0:
ordinal not in range(128)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list