changing string encoding to different charset?

Daniel Woodhouse wodemoneke at gmail.com
Sun Dec 14 09:21:16 EST 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: <http://mail.python.org/pipermail/python-list/attachments/20081214/9df9ddcf/attachment-0001.html>


More information about the Python-list mailing list