Author lemburg
Recipients AndersMunch, lemburg, paul.moore, steve.dower, swt2c, tim.golden, zach.ware
Date 2021-02-17.12:18:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On 17.02.2021 12:36, Anders Munch wrote:
> getlocale is documented to return None for the encoding if no encoding can be determined.  There's no need to guess.

Well, not quite... the documentation says that None can be returned,
not that it will return None in such cases.

What happens is that the value returned by the C lib's setlocale()
is normalized and parsed. If it doesn't include an encoding,
the table locale_alias is used to provide an encoding. If this
table does not include the locale, you get the ValueError.

We could enhance this to return None for the encoding instead
of raising an exception, but would this really help ?

Alternatively, we could add "en_DE" to the alias table and set
a default encoding to use. I assume this would have to be
ISO8859-15. OTOH, Windows supports UTF-8 for all locales in
more recent Windows versions, so perhaps we should use UTF-8

BTW: What is wxWidgets doing with the returned values ?

- setlocale() in Visual C++ on Windows:
- locale name formats supported by Windows CRT:
- Language locale tags known by Windows:
- UTF8 support in Windows CRT:
Date User Action Args
2021-02-17 12:18:38lemburgsetrecipients: + lemburg, paul.moore, tim.golden, zach.ware, steve.dower, swt2c, AndersMunch
2021-02-17 12:18:38lemburglinkissue43115 messages
2021-02-17 12:18:38lemburgcreate