[issue9821] Support PEP 383 on Windows: mbcs support of surrogateescape error handler

STINNER Victor report at bugs.python.org
Fri Sep 10 14:16:22 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Oh wait. PEP 383 is a solution to store undecodable bytes in an unicode string, but for mbcs I'm trying to get the opposite: store unicode in bytes and this is not possible (at least with PEP 383).

Example with Python 3.1:

>>> print("abcŁdef".encode("cp1252", "surrogateescape"))
...
UnicodeEncodeError: 'charmap' codec can't encode character '\u0141' in position 3: character maps to <undefined>

----------

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


More information about the Python-bugs-list mailing list