Author serhiy.storchaka
Recipients lemburg, loewis, serhiy.storchaka
Date 2013-12-28.09:29:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1388222989.89.0.773650778168.issue20087@psf.upfronthosting.co.za>
In-reply-to
Content
The locale module uses locale alias table derived from X11 locale.alias file for mapping bare locale names without encodings to locale names with encodings. However sometimes glibc default encoding for a locale differs from that used in X11 locale.alias.

Here is full differences table:

                 GLibc                 X11 locale.alias

az_az            az_AZ.UTF-8           az_AZ.ISO8859-9E
ca_ad            ca_AD.ISO8859-15      ca_AD.ISO8859-1
ca_fr            ca_FR.ISO8859-15      ca_FR.ISO8859-1
ca_it            ca_IT.ISO8859-15      ca_IT.ISO8859-1
cy_gb            cy_GB.ISO8859-14      cy_GB.ISO8859-1
en_in            en_IN.UTF-8           en_IN.ISO8859-1
et_ee            et_EE.ISO8859-1       et_EE.ISO8859-15
fi_fi            fi_FI.ISO8859-1       fi_FI.ISO8859-15
gd_gb            gd_GB.ISO8859-15      gd_GB.ISO8859-1
hi_in            hi_IN.UTF-8           hi_IN.ISCII-DEV
iu_ca            iu_CA.UTF-8           iu_CA.NUNACOM-8
iw_il            iw_IL.ISO8859-8       he_IL.ISO8859-8
ka_ge            ka_GE.GEORGIAN_PS     ka_GE.GEORGIAN-ACADEMY
lo_la            lo_LA.UTF-8           lo_LA.MULELAO-1
mi_nz            mi_NZ.ISO8859-13      mi_NZ.ISO8859-1
nr_za            nr_ZA.UTF-8           nr_ZA.ISO8859-1
nso_za           nso_ZA.UTF-8          nso_ZA.ISO8859-15
ru_ru            ru_RU.ISO8859-5       ru_RU.UTF-8
rw_rw            rw_RW.UTF-8           rw_RW.ISO8859-1
sq_al            sq_AL.ISO8859-1       sq_AL.ISO8859-2
ss_za            ss_ZA.UTF-8           ss_ZA.ISO8859-1
ta_in            ta_IN.UTF-8           ta_IN.TSCII-0
tg_tj            tg_TJ.KOI8_T          tg_TJ.KOI8-C
th_th            th_TH.TIS_620         th_TH.ISO8859-11
tn_za            tn_ZA.UTF-8           tn_ZA.ISO8859-15
ts_za            ts_ZA.UTF-8           ts_ZA.ISO8859-1
tt_ru            tt_RU.UTF-8           tt_RU.TATAR-CYR
ur_pk            ur_PK.UTF-8           ur_PK.CP1256
uz_uz            uz_UZ.ISO8859-1       uz_UZ.UTF-8
uz_uz@cyrillic   uz_UZ.UTF-8@cyrillic  uz_UZ.UTF-8
vi_vn            vi_VN.UTF-8           vi_VN.TCVN
zh_cn            zh_CN.GB2312          zh_CN.gb2312
zh_tw            zh_TW.BIG5            zh_TW.big5
zh_tw.euctw      zh_TW.EUC_TW          zh_TW.eucTW

For example with the en_IN encoding:

>>> import locale, _locale
>>> _locale.setlocale(locale.LC_CTYPE)
'en_IN'
>>> locale.getlocale()
('en_IN', 'ISO8859-1')
>>> locale.nl_langinfo(locale.CODESET)
'UTF-8'
>>> locale.setlocale(locale.LC_CTYPE, locale.getlocale())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/locale.py", line 592, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
History
Date User Action Args
2013-12-28 09:29:49serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, loewis
2013-12-28 09:29:49serhiy.storchakasetmessageid: <1388222989.89.0.773650778168.issue20087@psf.upfronthosting.co.za>
2013-12-28 09:29:49serhiy.storchakalinkissue20087 messages
2013-12-28 09:29:49serhiy.storchakacreate