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 mattheww
Recipients mattheww
Date 2017-06-25.16:58:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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/ . 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).
Date User Action Args
2017-06-25 16:58:59matthewwsetrecipients: + mattheww
2017-06-25 16:58:59matthewwsetmessageid: <>
2017-06-25 16:58:59matthewwlinkissue30755 messages
2017-06-25 16:58:58matthewwcreate