[issue12281] bytes.decode('mbcs', 'ignore') does replace undecodable bytes on Windows Vista or later

STINNER Victor report at bugs.python.org
Wed Jun 8 14:59:38 CEST 2011


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

> Example with ANSI=cp932 (on Windows Seven):
>  - b'abc\xffdef'.decode('mbcs', 'replace') gives 'abc\uf8f3def'
>  - b'abc\xffdef'.decode('mbcs', 'ignore') gives 'abcdef'

Oh, and b'\xff'.decode('mbcs', 'surrogateescape') gives '\udcff' as expected. At least for surrogateescape, it would be nice that mbcs supports any error handler on encoding.

----------

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


More information about the Python-bugs-list mailing list