This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients asmodai, eric.araujo, lemburg, loewis, pitrou, ubuntujenkins
Date 2010-04-12.20:09:23
SpamBayes Score 3.708193e-09
Marked as misclassified No
Message-id <4BC37DF2.8060702@v.loewis.de>
In-reply-to <4BC2D7AD.4020201@egenix.com>
Content
> getdefaultlocale() provides a way to access the default locale
> (and encoding) on a platform without requiring a call to
> setlocale(LC_ALL, "")

That's what it's meant to do, but this is not what it actually does.
In fact, there is no way of determining the locale's encoding without
the help o fthe C library. As for "default locale": this is a flawed
notion in itself. If I use one locale for messages, and the other for
date representation - which one should be the "default" locale?
Also, "default" in what respect?

> getpreferredencoding() just provides encoding information. It doesn't
> provide locale information, so I don't see how that could be used
> as replacement for getdefaultlocale().

Many applications use getdefaultlocale()[1], i.e. ignore the locale part
of the result. They can easily be rewritten to use getpreferredencoding.

> The table needed for normalizing the various locale strings used in
> the LANG environment variable (and others) needs to be updated every
> now and then, but that's natural for a resource that changes based
> on what people use locales for in real life.

However, it also changes based on local administrator preferences -
something that the implementation does not take into account at all.
It may also depend on OS vendor preferences, which is also not
considered in the implementation.

IOW, it returns bogus results.
History
Date User Action Args
2010-04-12 20:09:27loewissetrecipients: + loewis, lemburg, pitrou, asmodai, eric.araujo, ubuntujenkins
2010-04-12 20:09:24loewislinkissue8374 messages
2010-04-12 20:09:23loewiscreate