New submission from Matthew Woodcraft: I have a system where the default locale is C.UTF-8, and en_US.UTF-8 is not installed.
But locale.normalize() unhelpfully converts "C.UTF-8" to "en_US.UTF-8". So the following crashes for me: python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, ('C', 'UTF-8'))" Similarly getdefaultlocale() returns ('en_US', 'UTF-8'), so this crashes too: export LANG=C.UTF-8 unset LC_CTYPE unset LC_ALL unset LANGUAGE python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())" This behaviour is caused by a locale_alias entry in Lib/locale.py . https://bugs.python.org/issue20076 documents its addition but doesn't provide a rationale. I can see that it might be helpful to provide such a conversion if C.UTF-8 doesn't exist and en_US.UTF-8 does, but the current code is breaking modern correctly-configured systems for the benefit of old misconfigured ones (C.UTF-8 shouldn't really be in the environment if it isn't available on the system, after all). ---------- messages: 296828 nosy: mattheww priority: normal severity: normal status: open title: locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8 versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30755> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com