Marc-Andre Lemburg added the comment:

The main purpose of the alias table is to support normalization and this is 
used for getdefaultencoding() which was created to be able to determine the 
default encoding based on what X.org uses as default without doing temporary 
setlocale() tricks.

Now, normalization also happens when passing a locale value to the underlying 
setlocale(), mainly to avoid many common bugs due to setlocale() being 
extremely picky about the locale value. A side effect of this is that 
normalization will also kick in to add the encoding in case no encoding is 
given in the parameter.

Note that no normalization is necessary to simply set the configured default 
locale configured on the system. In such a case, you'd run setlocale('LC_ALL') 
and get what's configured.

If you run the lib C setlocale() with a locale without encoding, the encoding 
used by the system entirely on what's configured on the system. The SUPPORTED 
file only gives a hint at what glibc think it should install per default, but 
any admin or distributor could change these settings simply by running 
localedef with some other encoding (charmap in locale speak).

I suppose that we could resolve some of the confusion by adding a parameter to 
disable this normalization in setlocale().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20087>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to