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 <[email protected]>
<http://bugs.python.org/issue15278>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com