[issue15278] UnicodeDecodeError when readline in codecs.py

STINNER Victor report at bugs.python.org
Tue Oct 9 23:17:31 CEST 2012


STINNER Victor added the comment:

> with codecs.open('test.txt', 'wb', 'utf-16-le') as fp:

Since Python 2.6+, you can use io.open() which uses the new io library. The io library uses TextIOWrapper which uses incremental encoder and decoder and so handles multibyte encodings correctly (as UTF-16).

Said differently, this issue is already fixed in the io library.

It remembers me that I should propose again my PEP 400 :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15278>
_______________________________________


More information about the Python-bugs-list mailing list