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 vstinner
Recipients eryksun, guy.linton, paul.moore, steve.dower, tim.golden, vstinner, xtreak, zach.ware
Date 2020-02-11.12:24:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581423865.74.0.684284092187.issue37945@roundup.psfhosted.org>
In-reply-to
Content
For me, the locale.getlocale() function is broken. Python attempts to guess too many things about the current locale. For example, it relies on an hard coded locale.locale_encoding_alias dictionary which seems to come from X11!? In 2020, Wayland replaced X11 and locales are updated frequently. This dictionary makes no sense on Windows. For example, 'ka_ge' is mapped to 'ka_GE.GEORGIAN-ACADEMY': "GEORGIAN-ACADEMY" is not an encoding, what is the purpose of this string?

I fixed dozens and dozens of locale issues and I never ever used locale.getlocale(). I never understood its purpose nor how it guess the encoding.

I always use locale.setlocale(category) or locale.setlocale(category, None) which returns a simply string which I can pass back to locale.setlocale(category, string) to restore the locale, when I need to temporarily change a locale.
History
Date User Action Args
2020-02-11 12:24:25vstinnersetrecipients: + vstinner, paul.moore, tim.golden, guy.linton, zach.ware, eryksun, steve.dower, xtreak
2020-02-11 12:24:25vstinnersetmessageid: <1581423865.74.0.684284092187.issue37945@roundup.psfhosted.org>
2020-02-11 12:24:25vstinnerlinkissue37945 messages
2020-02-11 12:24:25vstinnercreate