[issue8784] tarfile/Windows: Don't use mbcs as the default encoding

STINNER Victor report at bugs.python.org
Thu Jun 10 19:19:04 CEST 2010

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

My tests with 7-zip and WinRAR conviced me that it's not a good idea to use utf-8 *by default* on Windows. But since mbcs doesn't support surrogateescape error handler, we should restore the previous behaviour just for this encoding.

tarfile_mbcs_errors.patch creates a function choose_errors() which determine the best error handler depending on the encoding and the mode (read or write):
 - "strict" to write with mbcs
 - "replace" to read with mbcs
 - "surrogateescape" otherwise

Please, review my changes on the documentation :-)

On Windows, patched tarfile works exactly as Python 3.1.

Added file: http://bugs.python.org/file17607/tarfile_mbcs_errors.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list