[issue6203] 3.x locale does not default to C, contrary to the documentation and to 2.x behavior

STINNER Victor report at bugs.python.org
Tue Jun 5 14:02:58 CEST 2012


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

> Either the code is incorrect in 3.1
> or the documentation should be updated.

Leaving LC_CTYPE unchanged (use the "C" locale, which is ASCII in most
cases) at Python startup would be a major change in Python 3. I don't
want to change this. You would see a lot of mojibake in your GUIs and get a lot of ugly surrogate characters in filenames (because of the PEP
393) if we don't set the LC_CTYPE to the user preferred encoding at startup anymore.

Setting the LC_CTYPE to the user preferred encoding is just very
convinient and helps Python to speak to the user though the console,
to the filesystem, to pass arguments on a command line of a
subprocess, etc. For example, you cannot pass non-ASCII characters to
a subprocess, characters written by the user in your GUI, if your
current LC_CTYPE locale is C (ASCII): you get an Unicode encode error.

So it's just a documentation issue: see my attached patch.

----------
keywords: +patch
Added file: http://bugs.python.org/file25830/locale_doc.patch

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


More information about the Python-bugs-list mailing list