From 5a3fd6ccb7f015fa5fc0b163dbd1198fb3ddacff Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sat, 10 Aug 2024 16:43:39 +0900 Subject: [PATCH] Correct invalid universal locale names These probably don't matter for anything. According to the comments in locale.alias, univ and universal apply to HPUX 9.x. But the "en_US.utf" values are obviously incorrect, and invalid in glibc. Debian has been carrying this patch since around Python 2.4. Either it should be upstream, or it should be dropped from Debian. Looking into this leads to bpo-20087, which temporarily fixed this before, as part of a larger cleanup in the migration to glibc 2.24 locales. That was reverted. The invalid value itself comes from xfree86, as far as I can tell. It appeared in 1999 [0] and were corrected in 2000 [1]. locale.py was written in-between and cribbed the broken values [2]. [0]: https://gitlab.freedesktop.org/ajax/xfree86/-/commit/16664e079de9938a4354e94c5c5afe5476bbaa98#8c0c2f24be5c75f99e8d6e55aa310736636d2584_10_480 [1]: https://gitlab.freedesktop.org/ajax/xfree86/-/commit/40f478e907f33fc56633bb16f7a6756314d0c10d?page=3#8c0c2f24be5c75f99e8d6e55aa310736636d2584_496_496 [2]: 5431bc36026c9cd61046b65a0bd343f37f42c410 --- Lib/locale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/locale.py b/Lib/locale.py index d8c09f1123d318..082645105b4f55 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -1407,8 +1407,8 @@ def getpreferredencoding(do_setlocale=True): 'ug_cn': 'ug_CN.UTF-8', 'uk': 'uk_UA.KOI8-U', 'uk_ua': 'uk_UA.KOI8-U', - 'univ': 'en_US.utf', - 'universal': 'en_US.utf', + 'univ': 'en_US.UTF-8', + 'universal': 'en_US.UTF-8', 'universal.utf8@ucs4': 'en_US.UTF-8', 'unm_us': 'unm_US.UTF-8', 'ur': 'ur_PK.CP1256',