[Python-checkins] [3.6] bpo-20087: Update locale alias mapping with glibc 2.27 supported locales. (GH-6708) (GH-6714)

Serhiy Storchaka webhook-mailer at python.org
Sun May 6 03:20:44 EDT 2018


https://github.com/python/cpython/commit/b1c70d0ffbb235def1deab62a744ffd9b5253924
commit: b1c70d0ffbb235def1deab62a744ffd9b5253924
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-05-06T10:20:42+03:00
summary:

[3.6] bpo-20087: Update locale alias mapping with glibc 2.27 supported locales. (GH-6708) (GH-6714)

(cherry picked from commit cedc9b74202d8c1ae39bca261cbb45d42ed54d45)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
A Misc/NEWS.d/next/Library/2018-05-05-18-02-24.bpo-20087.lJrvXL.rst
M Lib/locale.py
M Lib/test/test_locale.py

diff --git a/Lib/locale.py b/Lib/locale.py
index 4de0090ed9dd..e85f34ea1996 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -828,6 +828,16 @@ def getpreferredencoding(do_setlocale = True):
 #
 # SS 2014-10-01:
 # Updated alias mapping with glibc 2.19 supported locales.
+#
+# SS 2018-05-05:
+# Updated alias mapping with glibc 2.27 supported locales.
+#
+# These are the differences compared to the old mapping (Python 3.6.5
+# and older):
+#
+#    updated 'ca_es at valencia' -> 'ca_ES.ISO8859-15 at valencia' to 'ca_ES.UTF-8 at valencia'
+#    updated 'kk_kz' -> 'kk_KZ.RK1048' to 'kk_KZ.ptcp154'
+#    updated 'russian' -> 'ru_RU.ISO8859-5' to 'ru_RU.KOI8-R'
 
 locale_alias = {
     'a3':                                   'az_AZ.KOI8-C',
@@ -838,10 +848,13 @@ def getpreferredencoding(do_setlocale = True):
     'aa_et':                                'aa_ET.UTF-8',
     'af':                                   'af_ZA.ISO8859-1',
     'af_za':                                'af_ZA.ISO8859-1',
+    'agr_pe':                               'agr_PE.UTF-8',
+    'ak_gh':                                'ak_GH.UTF-8',
     'am':                                   'am_ET.UTF-8',
     'am_et':                                'am_ET.UTF-8',
     'american':                             'en_US.ISO8859-1',
     'an_es':                                'an_ES.ISO8859-15',
+    'anp_in':                               'anp_IN.UTF-8',
     'ar':                                   'ar_AA.ISO8859-6',
     'ar_aa':                                'ar_AA.ISO8859-6',
     'ar_ae':                                'ar_AE.ISO8859-6',
@@ -859,6 +872,7 @@ def getpreferredencoding(do_setlocale = True):
     'ar_qa':                                'ar_QA.ISO8859-6',
     'ar_sa':                                'ar_SA.ISO8859-6',
     'ar_sd':                                'ar_SD.ISO8859-6',
+    'ar_ss':                                'ar_SS.UTF-8',
     'ar_sy':                                'ar_SY.ISO8859-6',
     'ar_tn':                                'ar_TN.ISO8859-6',
     'ar_ye':                                'ar_YE.ISO8859-6',
@@ -870,6 +884,7 @@ def getpreferredencoding(do_setlocale = True):
     'az':                                   'az_AZ.ISO8859-9E',
     'az_az':                                'az_AZ.ISO8859-9E',
     'az_az.iso88599e':                      'az_AZ.ISO8859-9E',
+    'az_ir':                                'az_IR.UTF-8',
     'be':                                   'be_BY.CP1251',
     'be at latin':                             'be_BY.UTF-8 at latin',
     'be_bg.utf8':                           'bg_BG.UTF-8',
@@ -880,7 +895,10 @@ def getpreferredencoding(do_setlocale = True):
     'ber_ma':                               'ber_MA.UTF-8',
     'bg':                                   'bg_BG.CP1251',
     'bg_bg':                                'bg_BG.CP1251',
+    'bhb_in.utf8':                          'bhb_IN.UTF-8',
     'bho_in':                               'bho_IN.UTF-8',
+    'bho_np':                               'bho_NP.UTF-8',
+    'bi_vu':                                'bi_VU.UTF-8',
     'bn_bd':                                'bn_BD.UTF-8',
     'bn_in':                                'bn_IN.UTF-8',
     'bo_cn':                                'bo_CN.UTF-8',
@@ -905,13 +923,17 @@ def getpreferredencoding(do_setlocale = True):
     'ca':                                   'ca_ES.ISO8859-1',
     'ca_ad':                                'ca_AD.ISO8859-1',
     'ca_es':                                'ca_ES.ISO8859-1',
-    'ca_es at valencia':                       'ca_ES.ISO8859-15 at valencia',
+    'ca_es at valencia':                       'ca_ES.UTF-8 at valencia',
     'ca_fr':                                'ca_FR.ISO8859-1',
     'ca_it':                                'ca_IT.ISO8859-1',
     'catalan':                              'ca_ES.ISO8859-1',
+    'ce_ru':                                'ce_RU.UTF-8',
     'cextend':                              'en_US.ISO8859-1',
     'chinese-s':                            'zh_CN.eucCN',
     'chinese-t':                            'zh_TW.eucTW',
+    'chr_us':                               'chr_US.UTF-8',
+    'ckb_iq':                               'ckb_IQ.UTF-8',
+    'cmn_tw':                               'cmn_TW.UTF-8',
     'crh_ua':                               'crh_UA.UTF-8',
     'croatian':                             'hr_HR.ISO8859-2',
     'cs':                                   'cs_CZ.ISO8859-2',
@@ -933,6 +955,7 @@ def getpreferredencoding(do_setlocale = True):
     'de_be':                                'de_BE.ISO8859-1',
     'de_ch':                                'de_CH.ISO8859-1',
     'de_de':                                'de_DE.ISO8859-1',
+    'de_it':                                'de_IT.ISO8859-1',
     'de_li.utf8':                           'de_LI.UTF-8',
     'de_lu':                                'de_LU.ISO8859-1',
     'deutsch':                              'de_DE.ISO8859-1',
@@ -959,10 +982,12 @@ def getpreferredencoding(do_setlocale = True):
     'en_gb':                                'en_GB.ISO8859-1',
     'en_hk':                                'en_HK.ISO8859-1',
     'en_ie':                                'en_IE.ISO8859-1',
+    'en_il':                                'en_IL.UTF-8',
     'en_in':                                'en_IN.ISO8859-1',
     'en_ng':                                'en_NG.UTF-8',
     'en_nz':                                'en_NZ.ISO8859-1',
     'en_ph':                                'en_PH.ISO8859-1',
+    'en_sc.utf8':                           'en_SC.UTF-8',
     'en_sg':                                'en_SG.ISO8859-1',
     'en_uk':                                'en_GB.ISO8859-1',
     'en_us':                                'en_US.ISO8859-1',
@@ -973,6 +998,7 @@ def getpreferredencoding(do_setlocale = True):
     'en_zw.utf8':                           'en_ZS.UTF-8',
     'eng_gb':                               'en_GB.ISO8859-1',
     'english':                              'en_EN.ISO8859-1',
+    'english.iso88591':                     'en_US.ISO8859-1',
     'english_uk':                           'en_GB.ISO8859-1',
     'english_united-states':                'en_US.ISO8859-1',
     'english_united-states.437':            'C',
@@ -1053,12 +1079,14 @@ def getpreferredencoding(do_setlocale = True):
     'gv':                                   'gv_GB.ISO8859-1',
     'gv_gb':                                'gv_GB.ISO8859-1',
     'ha_ng':                                'ha_NG.UTF-8',
+    'hak_tw':                               'hak_TW.UTF-8',
     'he':                                   'he_IL.ISO8859-8',
     'he_il':                                'he_IL.ISO8859-8',
     'hebrew':                               'he_IL.ISO8859-8',
     'hi':                                   'hi_IN.ISCII-DEV',
     'hi_in':                                'hi_IN.ISCII-DEV',
     'hi_in.isciidev':                       'hi_IN.ISCII-DEV',
+    'hif_fj':                               'hif_FJ.UTF-8',
     'hne':                                  'hne_IN.UTF-8',
     'hne_in':                               'hne_IN.UTF-8',
     'hr':                                   'hr_HR.ISO8859-2',
@@ -1113,7 +1141,8 @@ def getpreferredencoding(do_setlocale = True):
     'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',
     'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',
     'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',
-    'kk_kz':                                'kk_KZ.RK1048',
+    'kab_dz':                               'kab_DZ.UTF-8',
+    'kk_kz':                                'kk_KZ.ptcp154',
     'kl':                                   'kl_GL.ISO8859-1',
     'kl_gl':                                'kl_GL.ISO8859-1',
     'km_kh':                                'km_KH.UTF-8',
@@ -1139,6 +1168,7 @@ def getpreferredencoding(do_setlocale = True):
     'li_nl':                                'li_NL.UTF-8',
     'lij_it':                               'lij_IT.UTF-8',
     'lithuanian':                           'lt_LT.ISO8859-13',
+    'ln_cd':                                'ln_CD.UTF-8',
     'lo':                                   'lo_LA.MULELAO-1',
     'lo_la':                                'lo_LA.MULELAO-1',
     'lo_la.cp1133':                         'lo_LA.IBM-CP1133',
@@ -1148,13 +1178,18 @@ def getpreferredencoding(do_setlocale = True):
     'lt_lt':                                'lt_LT.ISO8859-13',
     'lv':                                   'lv_LV.ISO8859-13',
     'lv_lv':                                'lv_LV.ISO8859-13',
+    'lzh_tw':                               'lzh_TW.UTF-8',
     'mag_in':                               'mag_IN.UTF-8',
     'mai':                                  'mai_IN.UTF-8',
     'mai_in':                               'mai_IN.UTF-8',
+    'mai_np':                               'mai_NP.UTF-8',
+    'mfe_mu':                               'mfe_MU.UTF-8',
     'mg_mg':                                'mg_MG.ISO8859-15',
     'mhr_ru':                               'mhr_RU.UTF-8',
     'mi':                                   'mi_NZ.ISO8859-1',
     'mi_nz':                                'mi_NZ.ISO8859-1',
+    'miq_ni':                               'miq_NI.UTF-8',
+    'mjw_in':                               'mjw_IN.UTF-8',
     'mk':                                   'mk_MK.ISO8859-5',
     'mk_mk':                                'mk_MK.ISO8859-5',
     'ml':                                   'ml_IN.UTF-8',
@@ -1168,7 +1203,7 @@ def getpreferredencoding(do_setlocale = True):
     'mt':                                   'mt_MT.ISO8859-3',
     'mt_mt':                                'mt_MT.ISO8859-3',
     'my_mm':                                'my_MM.UTF-8',
-    'nan_tw at latin':                         'nan_TW.UTF-8 at latin',
+    'nan_tw':                               'nan_TW.UTF-8',
     'nb':                                   'nb_NO.ISO8859-1',
     'nb_no':                                'nb_NO.ISO8859-1',
     'nds_de':                               'nds_DE.UTF-8',
@@ -1207,6 +1242,8 @@ def getpreferredencoding(do_setlocale = True):
     'pa_in':                                'pa_IN.UTF-8',
     'pa_pk':                                'pa_PK.UTF-8',
     'pap_an':                               'pap_AN.UTF-8',
+    'pap_aw':                               'pap_AW.UTF-8',
+    'pap_cw':                               'pap_CW.UTF-8',
     'pd':                                   'pd_US.ISO8859-1',
     'pd_de':                                'pd_DE.ISO8859-1',
     'pd_us':                                'pd_US.ISO8859-1',
@@ -1225,6 +1262,8 @@ def getpreferredencoding(do_setlocale = True):
     'pt':                                   'pt_PT.ISO8859-1',
     'pt_br':                                'pt_BR.ISO8859-1',
     'pt_pt':                                'pt_PT.ISO8859-1',
+    'quz_pe':                               'quz_PE.UTF-8',
+    'raj_in':                               'raj_IN.UTF-8',
     'ro':                                   'ro_RO.ISO8859-2',
     'ro_ro':                                'ro_RO.ISO8859-2',
     'romanian':                             'ro_RO.ISO8859-2',
@@ -1232,7 +1271,7 @@ def getpreferredencoding(do_setlocale = True):
     'ru_ru':                                'ru_RU.UTF-8',
     'ru_ua':                                'ru_UA.KOI8-U',
     'rumanian':                             'ro_RO.ISO8859-2',
-    'russian':                              'ru_RU.ISO8859-5',
+    'russian':                              'ru_RU.KOI8-R',
     'rw':                                   'rw_RW.ISO8859-1',
     'rw_rw':                                'rw_RW.ISO8859-1',
     'sa_in':                                'sa_IN.UTF-8',
@@ -1244,12 +1283,14 @@ def getpreferredencoding(do_setlocale = True):
     'sd_pk':                                'sd_PK.UTF-8',
     'se_no':                                'se_NO.UTF-8',
     'serbocroatian':                        'sr_RS.UTF-8 at latin',
+    'sgs_lt':                               'sgs_LT.UTF-8',
     'sh':                                   'sr_RS.UTF-8 at latin',
     'sh_ba.iso88592 at bosnia':                'sr_CS.ISO8859-2',
     'sh_hr':                                'sh_HR.ISO8859-2',
     'sh_hr.iso88592':                       'hr_HR.ISO8859-2',
     'sh_sp':                                'sr_CS.ISO8859-2',
     'sh_yu':                                'sr_RS.UTF-8 at latin',
+    'shn_mm':                               'shn_MM.UTF-8',
     'shs_ca':                               'shs_CA.UTF-8',
     'si':                                   'si_LK.UTF-8',
     'si_lk':                                'si_LK.UTF-8',
@@ -1263,6 +1304,7 @@ def getpreferredencoding(do_setlocale = True):
     'slovak':                               'sk_SK.ISO8859-2',
     'slovene':                              'sl_SI.ISO8859-2',
     'slovenian':                            'sl_SI.ISO8859-2',
+    'sm_ws':                                'sm_WS.UTF-8',
     'so_dj':                                'so_DJ.ISO8859-1',
     'so_et':                                'so_ET.UTF-8',
     'so_ke':                                'so_KE.ISO8859-1',
@@ -1309,6 +1351,7 @@ def getpreferredencoding(do_setlocale = True):
     'ta_in.tscii':                          'ta_IN.TSCII-0',
     'ta_in.tscii0':                         'ta_IN.TSCII-0',
     'ta_lk':                                'ta_LK.UTF-8',
+    'tcy_in.utf8':                          'tcy_IN.UTF-8',
     'te':                                   'te_IN.UTF-8',
     'te_in':                                'te_IN.UTF-8',
     'tg':                                   'tg_TJ.KOI8-C',
@@ -1318,6 +1361,7 @@ def getpreferredencoding(do_setlocale = True):
     'th_th.tactis':                         'th_TH.TIS620',
     'th_th.tis620':                         'th_TH.TIS620',
     'thai':                                 'th_TH.ISO8859-11',
+    'the_np':                               'the_NP.UTF-8',
     'ti_er':                                'ti_ER.UTF-8',
     'ti_et':                                'ti_ET.UTF-8',
     'tig_er':                               'tig_ER.UTF-8',
@@ -1326,6 +1370,8 @@ def getpreferredencoding(do_setlocale = True):
     'tl_ph':                                'tl_PH.ISO8859-1',
     'tn':                                   'tn_ZA.ISO8859-15',
     'tn_za':                                'tn_ZA.ISO8859-15',
+    'to_to':                                'to_TO.UTF-8',
+    'tpi_pg':                               'tpi_PG.UTF-8',
     'tr':                                   'tr_TR.ISO8859-9',
     'tr_cy':                                'tr_CY.ISO8859-9',
     'tr_tr':                                'tr_TR.ISO8859-9',
@@ -1368,6 +1414,7 @@ def getpreferredencoding(do_setlocale = True):
     'yi_us':                                'yi_US.CP1255',
     'yo_ng':                                'yo_NG.UTF-8',
     'yue_hk':                               'yue_HK.UTF-8',
+    'yuw_pg':                               'yuw_PG.UTF-8',
     'zh':                                   'zh_CN.eucCN',
     'zh_cn':                                'zh_CN.gb2312',
     'zh_cn.big5':                           'zh_TW.big5',
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 650d7373d8e1..a5ec2c51c55d 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -430,7 +430,7 @@ def test_latin_modifier(self):
 
     def test_valencia_modifier(self):
         self.check('ca_ES.UTF-8 at valencia', 'ca_ES.UTF-8 at valencia')
-        self.check('ca_ES at valencia', 'ca_ES.ISO8859-15 at valencia')
+        self.check('ca_ES at valencia', 'ca_ES.UTF-8 at valencia')
         self.check('ca at valencia', 'ca_ES.ISO8859-1 at valencia')
 
     def test_devanagari_modifier(self):
diff --git a/Misc/NEWS.d/next/Library/2018-05-05-18-02-24.bpo-20087.lJrvXL.rst b/Misc/NEWS.d/next/Library/2018-05-05-18-02-24.bpo-20087.lJrvXL.rst
new file mode 100644
index 000000000000..2342cb781926
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-05-05-18-02-24.bpo-20087.lJrvXL.rst
@@ -0,0 +1 @@
+Updated alias mapping with glibc 2.27 supported locales.



More information about the Python-checkins mailing list