STINNER Victor added the comment:

>>> ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape')
b'\xff\xdcq\x00w\x00e\x00r\x00t\x00y\x00'

Oh, this is a bug in the UTF-16 encoder: it should not encode surrogate 
characters => see issue #12892

I read that it's possible to set a standard stream like stdout in UTF-16 mode 
on Windows. I don't know if it's commonly used, nor it would impact Python. I 
never see a platform using UTF-16 or UTF-32 for standard streams.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18713>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to