[New-bugs-announce] [issue12112] The new packaging module should not use the locale encoding

STINNER Victor report at bugs.python.org
Thu May 19 13:54:28 CEST 2011

New submission from STINNER Victor <victor.stinner at haypocalc.com>:

The locale encoding is not portable, packaging should use UTF-8 instead.

Attached patch is a draft to workaround "LANG=C ./python -m test test_packaging" failures. I'm not sure that my test in Metadata.write_file() of packaging.metadata is a good idea.

Moreover, packaging should also maybe use the surrogateescape error handler, but I propose to decide that later and in another issue. We may use this error handler only to read files (like the Python makefile).

For write a complete patch, *all* calls to open() in Lib/packaging/* (including Lib/packaging/tests/*) should be checked.

distutils uses the locale encoding, which is UTF-8 on Mac OS X and most Linux setup (but never on Windows). But distutils cannot be fixed, whereas packaging is a new module and can be fixed.

files: packaging_utf8.patch
keywords: patch
messages: 136280
nosy: haypo
priority: normal
severity: normal
status: open
title: The new packaging module should not use the locale encoding
versions: Python 3.3
Added file: http://bugs.python.org/file22028/packaging_utf8.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list