Message172529
| Author |
vstinner |
| Recipients |
Marcus.Gröber, ezio.melotti, lovelylain, serhiy.storchaka, vstinner |
| Date |
2012年10月09日.21:17:31 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1349817451.5.0.448433583768.issue15278@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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 :-) |
|