Home | History | Annotate | Download | only in Lib
      1 """Locale support module.
      2 
      3 The module provides low-level access to the C lib's locale APIs and adds high
      4 level number formatting APIs as well as a locale aliasing engine to complement
      5 these.
      6 
      7 The aliasing engine includes support for many commonly used locale names and
      8 maps them to values suitable for passing to the C lib's setlocale() function. It
      9 also includes default encodings for all supported locale names.
     10 """
     11 
     12 import sys
     13 import encodings
     14 import encodings.aliases
     15 import re
     16 import operator
     17 import functools
     18 
     19 # keep a copy of the builtin str type, because 'str' name is overridden
     20 # in globals by a function below
     21 _str = str
     22 
     23 try:
     24     _unicode = unicode
     25 except NameError:
     26     # If Python is built without Unicode support, the unicode type
     27     # will not exist. Fake one.
     28     class _unicode(object):
     29         pass
     30 
     31 # Try importing the _locale module.
     32 #
     33 # If this fails, fall back on a basic 'C' locale emulation.
     34 
     35 # Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before
     36 # trying the import.  So __all__ is also fiddled at the end of the file.
     37 __all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
     38            "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
     39            "str", "atof", "atoi", "format", "format_string", "currency",
     40            "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
     41            "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
     42 
     43 try:
     44 
     45     from _locale import *
     46 
     47 except ImportError:
     48 
     49     # Locale emulation
     50 
     51     CHAR_MAX = 127
     52     LC_ALL = 6
     53     LC_COLLATE = 3
     54     LC_CTYPE = 0
     55     LC_MESSAGES = 5
     56     LC_MONETARY = 4
     57     LC_NUMERIC = 1
     58     LC_TIME = 2
     59     Error = ValueError
     60 
     61     def localeconv():
     62         """ localeconv() -> dict.
     63             Returns numeric and monetary locale-specific parameters.
     64         """
     65         # 'C' locale default values
     66         return {'grouping': [127],
     67                 'currency_symbol': '',
     68                 'n_sign_posn': 127,
     69                 'p_cs_precedes': 127,
     70                 'n_cs_precedes': 127,
     71                 'mon_grouping': [],
     72                 'n_sep_by_space': 127,
     73                 'decimal_point': '.',
     74                 'negative_sign': '',
     75                 'positive_sign': '',
     76                 'p_sep_by_space': 127,
     77                 'int_curr_symbol': '',
     78                 'p_sign_posn': 127,
     79                 'thousands_sep': '',
     80                 'mon_thousands_sep': '',
     81                 'frac_digits': 127,
     82                 'mon_decimal_point': '',
     83                 'int_frac_digits': 127}
     84 
     85     def setlocale(category, value=None):
     86         """ setlocale(integer,string=None) -> string.
     87             Activates/queries locale processing.
     88         """
     89         if value not in (None, '', 'C'):
     90             raise Error, '_locale emulation only supports "C" locale'
     91         return 'C'
     92 
     93     def strcoll(a,b):
     94         """ strcoll(string,string) -> int.
     95             Compares two strings according to the locale.
     96         """
     97         return cmp(a,b)
     98 
     99     def strxfrm(s):
    100         """ strxfrm(string) -> string.
    101             Returns a string that behaves for cmp locale-aware.
    102         """
    103         return s
    104 
    105 
    106 _localeconv = localeconv
    107 
    108 # With this dict, you can override some items of localeconv's return value.
    109 # This is useful for testing purposes.
    110 _override_localeconv = {}
    111 
    112 @functools.wraps(_localeconv)
    113 def localeconv():
    114     d = _localeconv()
    115     if _override_localeconv:
    116         d.update(_override_localeconv)
    117     return d
    118 
    119 
    120 ### Number formatting APIs
    121 
    122 # Author: Martin von Loewis
    123 # improved by Georg Brandl
    124 
    125 # Iterate over grouping intervals
    126 def _grouping_intervals(grouping):
    127     last_interval = None
    128     for interval in grouping:
    129         # if grouping is -1, we are done
    130         if interval == CHAR_MAX:
    131             return
    132         # 0: re-use last group ad infinitum
    133         if interval == 0:
    134             if last_interval is None:
    135                 raise ValueError("invalid grouping")
    136             while True:
    137                 yield last_interval
    138         yield interval
    139         last_interval = interval
    140 
    141 #perform the grouping from right to left
    142 def _group(s, monetary=False):
    143     conv = localeconv()
    144     thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
    145     grouping = conv[monetary and 'mon_grouping' or 'grouping']
    146     if not grouping:
    147         return (s, 0)
    148     if s[-1] == ' ':
    149         stripped = s.rstrip()
    150         right_spaces = s[len(stripped):]
    151         s = stripped
    152     else:
    153         right_spaces = ''
    154     left_spaces = ''
    155     groups = []
    156     for interval in _grouping_intervals(grouping):
    157         if not s or s[-1] not in "0123456789":
    158             # only non-digit characters remain (sign, spaces)
    159             left_spaces = s
    160             s = ''
    161             break
    162         groups.append(s[-interval:])
    163         s = s[:-interval]
    164     if s:
    165         groups.append(s)
    166     groups.reverse()
    167     return (
    168         left_spaces + thousands_sep.join(groups) + right_spaces,
    169         len(thousands_sep) * (len(groups) - 1)
    170     )
    171 
    172 # Strip a given amount of excess padding from the given string
    173 def _strip_padding(s, amount):
    174     lpos = 0
    175     while amount and s[lpos] == ' ':
    176         lpos += 1
    177         amount -= 1
    178     rpos = len(s) - 1
    179     while amount and s[rpos] == ' ':
    180         rpos -= 1
    181         amount -= 1
    182     return s[lpos:rpos+1]
    183 
    184 _percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
    185                          r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
    186 
    187 def format(percent, value, grouping=False, monetary=False, *additional):
    188     """Returns the locale-aware substitution of a %? specifier
    189     (percent).
    190 
    191     additional is for format strings which contain one or more
    192     '*' modifiers."""
    193     # this is only for one-percent-specifier strings and this should be checked
    194     match = _percent_re.match(percent)
    195     if not match or len(match.group())!= len(percent):
    196         raise ValueError(("format() must be given exactly one %%char "
    197                          "format specifier, %s not valid") % repr(percent))
    198     return _format(percent, value, grouping, monetary, *additional)
    199 
    200 def _format(percent, value, grouping=False, monetary=False, *additional):
    201     if additional:
    202         formatted = percent % ((value,) + additional)
    203     else:
    204         formatted = percent % value
    205     # floats and decimal ints need special action!
    206     if percent[-1] in 'eEfFgG':
    207         seps = 0
    208         parts = formatted.split('.')
    209         if grouping:
    210             parts[0], seps = _group(parts[0], monetary=monetary)
    211         decimal_point = localeconv()[monetary and 'mon_decimal_point'
    212                                               or 'decimal_point']
    213         formatted = decimal_point.join(parts)
    214         if seps:
    215             formatted = _strip_padding(formatted, seps)
    216     elif percent[-1] in 'diu':
    217         seps = 0
    218         if grouping:
    219             formatted, seps = _group(formatted, monetary=monetary)
    220         if seps:
    221             formatted = _strip_padding(formatted, seps)
    222     return formatted
    223 
    224 def format_string(f, val, grouping=False):
    225     """Formats a string in the same way that the % formatting would use,
    226     but takes the current locale into account.
    227     Grouping is applied if the third parameter is true."""
    228     percents = list(_percent_re.finditer(f))
    229     new_f = _percent_re.sub('%s', f)
    230 
    231     if operator.isMappingType(val):
    232         new_val = []
    233         for perc in percents:
    234             if perc.group()[-1]=='%':
    235                 new_val.append('%')
    236             else:
    237                 new_val.append(format(perc.group(), val, grouping))
    238     else:
    239         if not isinstance(val, tuple):
    240             val = (val,)
    241         new_val = []
    242         i = 0
    243         for perc in percents:
    244             if perc.group()[-1]=='%':
    245                 new_val.append('%')
    246             else:
    247                 starcount = perc.group('modifiers').count('*')
    248                 new_val.append(_format(perc.group(),
    249                                       val[i],
    250                                       grouping,
    251                                       False,
    252                                       *val[i+1:i+1+starcount]))
    253                 i += (1 + starcount)
    254     val = tuple(new_val)
    255 
    256     return new_f % val
    257 
    258 def currency(val, symbol=True, grouping=False, international=False):
    259     """Formats val according to the currency settings
    260     in the current locale."""
    261     conv = localeconv()
    262 
    263     # check for illegal values
    264     digits = conv[international and 'int_frac_digits' or 'frac_digits']
    265     if digits == 127:
    266         raise ValueError("Currency formatting is not possible using "
    267                          "the 'C' locale.")
    268 
    269     s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
    270     # '<' and '>' are markers if the sign must be inserted between symbol and value
    271     s = '<' + s + '>'
    272 
    273     if symbol:
    274         smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
    275         precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
    276         separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
    277 
    278         if precedes:
    279             s = smb + (separated and ' ' or '') + s
    280         else:
    281             s = s + (separated and ' ' or '') + smb
    282 
    283     sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
    284     sign = conv[val<0 and 'negative_sign' or 'positive_sign']
    285 
    286     if sign_pos == 0:
    287         s = '(' + s + ')'
    288     elif sign_pos == 1:
    289         s = sign + s
    290     elif sign_pos == 2:
    291         s = s + sign
    292     elif sign_pos == 3:
    293         s = s.replace('<', sign)
    294     elif sign_pos == 4:
    295         s = s.replace('>', sign)
    296     else:
    297         # the default if nothing specified;
    298         # this should be the most fitting sign position
    299         s = sign + s
    300 
    301     return s.replace('<', '').replace('>', '')
    302 
    303 def str(val):
    304     """Convert float to string, taking the locale into account."""
    305     return format("%.12g", val)
    306 
    307 def atof(string, func=float):
    308     "Parses a string as a float according to the locale settings."
    309     #First, get rid of the grouping
    310     ts = localeconv()['thousands_sep']
    311     if ts:
    312         string = string.replace(ts, '')
    313     #next, replace the decimal point with a dot
    314     dd = localeconv()['decimal_point']
    315     if dd:
    316         string = string.replace(dd, '.')
    317     #finally, parse the string
    318     return func(string)
    319 
    320 def atoi(str):
    321     "Converts a string to an integer according to the locale settings."
    322     return atof(str, int)
    323 
    324 def _test():
    325     setlocale(LC_ALL, "")
    326     #do grouping
    327     s1 = format("%d", 123456789,1)
    328     print s1, "is", atoi(s1)
    329     #standard formatting
    330     s1 = str(3.14)
    331     print s1, "is", atof(s1)
    332 
    333 ### Locale name aliasing engine
    334 
    335 # Author: Marc-Andre Lemburg, mal (at] lemburg.com
    336 # Various tweaks by Fredrik Lundh <fredrik (at] pythonware.com>
    337 
    338 # store away the low-level version of setlocale (it's
    339 # overridden below)
    340 _setlocale = setlocale
    341 
    342 # Avoid relying on the locale-dependent .lower() method
    343 # (see issue #1813).
    344 _ascii_lower_map = ''.join(
    345     chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)
    346     for x in range(256)
    347 )
    348 
    349 def _replace_encoding(code, encoding):
    350     if '.' in code:
    351         langname = code[:code.index('.')]
    352     else:
    353         langname = code
    354     # Convert the encoding to a C lib compatible encoding string
    355     norm_encoding = encodings.normalize_encoding(encoding)
    356     #print('norm encoding: %r' % norm_encoding)
    357     norm_encoding = encodings.aliases.aliases.get(norm_encoding,
    358                                                   norm_encoding)
    359     #print('aliased encoding: %r' % norm_encoding)
    360     encoding = locale_encoding_alias.get(norm_encoding,
    361                                          norm_encoding)
    362     #print('found encoding %r' % encoding)
    363     return langname + '.' + encoding
    364 
    365 def normalize(localename):
    366 
    367     """ Returns a normalized locale code for the given locale
    368         name.
    369 
    370         The returned locale code is formatted for use with
    371         setlocale().
    372 
    373         If normalization fails, the original name is returned
    374         unchanged.
    375 
    376         If the given encoding is not known, the function defaults to
    377         the default encoding for the locale code just like setlocale()
    378         does.
    379 
    380     """
    381     # Normalize the locale name and extract the encoding and modifier
    382     if isinstance(localename, _unicode):
    383         localename = localename.encode('ascii')
    384     code = localename.translate(_ascii_lower_map)
    385     if ':' in code:
    386         # ':' is sometimes used as encoding delimiter.
    387         code = code.replace(':', '.')
    388     if '@' in code:
    389         code, modifier = code.split('@', 1)
    390     else:
    391         modifier = ''
    392     if '.' in code:
    393         langname, encoding = code.split('.')[:2]
    394     else:
    395         langname = code
    396         encoding = ''
    397 
    398     # First lookup: fullname (possibly with encoding and modifier)
    399     lang_enc = langname
    400     if encoding:
    401         norm_encoding = encoding.replace('-', '')
    402         norm_encoding = norm_encoding.replace('_', '')
    403         lang_enc += '.' + norm_encoding
    404     lookup_name = lang_enc
    405     if modifier:
    406         lookup_name += '@' + modifier
    407     code = locale_alias.get(lookup_name, None)
    408     if code is not None:
    409         return code
    410     #print('first lookup failed')
    411 
    412     if modifier:
    413         # Second try: fullname without modifier (possibly with encoding)
    414         code = locale_alias.get(lang_enc, None)
    415         if code is not None:
    416             #print('lookup without modifier succeeded')
    417             if '@' not in code:
    418                 return code + '@' + modifier
    419             if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:
    420                 return code
    421         #print('second lookup failed')
    422 
    423     if encoding:
    424         # Third try: langname (without encoding, possibly with modifier)
    425         lookup_name = langname
    426         if modifier:
    427             lookup_name += '@' + modifier
    428         code = locale_alias.get(lookup_name, None)
    429         if code is not None:
    430             #print('lookup without encoding succeeded')
    431             if '@' not in code:
    432                 return _replace_encoding(code, encoding)
    433             code, modifier = code.split('@', 1)
    434             return _replace_encoding(code, encoding) + '@' + modifier
    435 
    436         if modifier:
    437             # Fourth try: langname (without encoding and modifier)
    438             code = locale_alias.get(langname, None)
    439             if code is not None:
    440                 #print('lookup without modifier and encoding succeeded')
    441                 if '@' not in code:
    442                     return _replace_encoding(code, encoding) + '@' + modifier
    443                 code, defmod = code.split('@', 1)
    444                 if defmod.translate(_ascii_lower_map) == modifier:
    445                     return _replace_encoding(code, encoding) + '@' + defmod
    446 
    447     return localename
    448 
    449 def _parse_localename(localename):
    450 
    451     """ Parses the locale code for localename and returns the
    452         result as tuple (language code, encoding).
    453 
    454         The localename is normalized and passed through the locale
    455         alias engine. A ValueError is raised in case the locale name
    456         cannot be parsed.
    457 
    458         The language code corresponds to RFC 1766.  code and encoding
    459         can be None in case the values cannot be determined or are
    460         unknown to this implementation.
    461 
    462     """
    463     code = normalize(localename)
    464     if '@' in code:
    465         # Deal with locale modifiers
    466         code, modifier = code.split('@', 1)
    467         if modifier == 'euro' and '.' not in code:
    468             # Assume Latin-9 for @euro locales. This is bogus,
    469             # since some systems may use other encodings for these
    470             # locales. Also, we ignore other modifiers.
    471             return code, 'iso-8859-15'
    472 
    473     if '.' in code:
    474         return tuple(code.split('.')[:2])
    475     elif code == 'C':
    476         return None, None
    477     raise ValueError, 'unknown locale: %s' % localename
    478 
    479 def _build_localename(localetuple):
    480 
    481     """ Builds a locale code from the given tuple (language code,
    482         encoding).
    483 
    484         No aliasing or normalizing takes place.
    485 
    486     """
    487     language, encoding = localetuple
    488     if language is None:
    489         language = 'C'
    490     if encoding is None:
    491         return language
    492     else:
    493         return language + '.' + encoding
    494 
    495 def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
    496 
    497     """ Tries to determine the default locale settings and returns
    498         them as tuple (language code, encoding).
    499 
    500         According to POSIX, a program which has not called
    501         setlocale(LC_ALL, "") runs using the portable 'C' locale.
    502         Calling setlocale(LC_ALL, "") lets it use the default locale as
    503         defined by the LANG variable. Since we don't want to interfere
    504         with the current locale setting we thus emulate the behavior
    505         in the way described above.
    506 
    507         To maintain compatibility with other platforms, not only the
    508         LANG variable is tested, but a list of variables given as
    509         envvars parameter. The first found to be defined will be
    510         used. envvars defaults to the search path used in GNU gettext;
    511         it must always contain the variable name 'LANG'.
    512 
    513         Except for the code 'C', the language code corresponds to RFC
    514         1766.  code and encoding can be None in case the values cannot
    515         be determined.
    516 
    517     """
    518 
    519     try:
    520         # check if it's supported by the _locale module
    521         import _locale
    522         code, encoding = _locale._getdefaultlocale()
    523     except (ImportError, AttributeError):
    524         pass
    525     else:
    526         # make sure the code/encoding values are valid
    527         if sys.platform == "win32" and code and code[:2] == "0x":
    528             # map windows language identifier to language name
    529             code = windows_locale.get(int(code, 0))
    530         # ...add other platform-specific processing here, if
    531         # necessary...
    532         return code, encoding
    533 
    534     # fall back on POSIX behaviour
    535     import os
    536     lookup = os.environ.get
    537     for variable in envvars:
    538         localename = lookup(variable,None)
    539         if localename:
    540             if variable == 'LANGUAGE':
    541                 localename = localename.split(':')[0]
    542             break
    543     else:
    544         localename = 'C'
    545     return _parse_localename(localename)
    546 
    547 
    548 def getlocale(category=LC_CTYPE):
    549 
    550     """ Returns the current setting for the given locale category as
    551         tuple (language code, encoding).
    552 
    553         category may be one of the LC_* value except LC_ALL. It
    554         defaults to LC_CTYPE.
    555 
    556         Except for the code 'C', the language code corresponds to RFC
    557         1766.  code and encoding can be None in case the values cannot
    558         be determined.
    559 
    560     """
    561     localename = _setlocale(category)
    562     if category == LC_ALL and ';' in localename:
    563         raise TypeError, 'category LC_ALL is not supported'
    564     return _parse_localename(localename)
    565 
    566 def setlocale(category, locale=None):
    567 
    568     """ Set the locale for the given category.  The locale can be
    569         a string, an iterable of two strings (language code and encoding),
    570         or None.
    571 
    572         Iterables are converted to strings using the locale aliasing
    573         engine.  Locale strings are passed directly to the C lib.
    574 
    575         category may be given as one of the LC_* values.
    576 
    577     """
    578     if locale and not isinstance(locale, (_str, _unicode)):
    579         # convert to string
    580         locale = normalize(_build_localename(locale))
    581     return _setlocale(category, locale)
    582 
    583 def resetlocale(category=LC_ALL):
    584 
    585     """ Sets the locale for category to the default setting.
    586 
    587         The default setting is determined by calling
    588         getdefaultlocale(). category defaults to LC_ALL.
    589 
    590     """
    591     _setlocale(category, _build_localename(getdefaultlocale()))
    592 
    593 if sys.platform.startswith("win"):
    594     # On Win32, this will return the ANSI code page
    595     def getpreferredencoding(do_setlocale = True):
    596         """Return the charset that the user is likely using."""
    597         import _locale
    598         return _locale._getdefaultlocale()[1]
    599 else:
    600     # On Unix, if CODESET is available, use that.
    601     try:
    602         CODESET
    603     except NameError:
    604         # Fall back to parsing environment variables :-(
    605         def getpreferredencoding(do_setlocale = True):
    606             """Return the charset that the user is likely using,
    607             by looking at environment variables."""
    608             return getdefaultlocale()[1]
    609     else:
    610         def getpreferredencoding(do_setlocale = True):
    611             """Return the charset that the user is likely using,
    612             according to the system configuration."""
    613             if do_setlocale:
    614                 oldloc = setlocale(LC_CTYPE)
    615                 try:
    616                     setlocale(LC_CTYPE, "")
    617                 except Error:
    618                     pass
    619                 result = nl_langinfo(CODESET)
    620                 setlocale(LC_CTYPE, oldloc)
    621                 return result
    622             else:
    623                 return nl_langinfo(CODESET)
    624 
    625 
    626 ### Database
    627 #
    628 # The following data was extracted from the locale.alias file which
    629 # comes with X11 and then hand edited removing the explicit encoding
    630 # definitions and adding some more aliases. The file is usually
    631 # available as /usr/lib/X11/locale/locale.alias.
    632 #
    633 
    634 #
    635 # The local_encoding_alias table maps lowercase encoding alias names
    636 # to C locale encoding names (case-sensitive). Note that normalize()
    637 # first looks up the encoding in the encodings.aliases dictionary and
    638 # then applies this mapping to find the correct C lib name for the
    639 # encoding.
    640 #
    641 locale_encoding_alias = {
    642 
    643     # Mappings for non-standard encoding names used in locale names
    644     '437':                          'C',
    645     'c':                            'C',
    646     'en':                           'ISO8859-1',
    647     'jis':                          'JIS7',
    648     'jis7':                         'JIS7',
    649     'ajec':                         'eucJP',
    650 
    651     # Mappings from Python codec names to C lib encoding names
    652     'ascii':                        'ISO8859-1',
    653     'latin_1':                      'ISO8859-1',
    654     'iso8859_1':                    'ISO8859-1',
    655     'iso8859_10':                   'ISO8859-10',
    656     'iso8859_11':                   'ISO8859-11',
    657     'iso8859_13':                   'ISO8859-13',
    658     'iso8859_14':                   'ISO8859-14',
    659     'iso8859_15':                   'ISO8859-15',
    660     'iso8859_16':                   'ISO8859-16',
    661     'iso8859_2':                    'ISO8859-2',
    662     'iso8859_3':                    'ISO8859-3',
    663     'iso8859_4':                    'ISO8859-4',
    664     'iso8859_5':                    'ISO8859-5',
    665     'iso8859_6':                    'ISO8859-6',
    666     'iso8859_7':                    'ISO8859-7',
    667     'iso8859_8':                    'ISO8859-8',
    668     'iso8859_9':                    'ISO8859-9',
    669     'iso2022_jp':                   'JIS7',
    670     'shift_jis':                    'SJIS',
    671     'tactis':                       'TACTIS',
    672     'euc_jp':                       'eucJP',
    673     'euc_kr':                       'eucKR',
    674     'utf_8':                        'UTF-8',
    675     'koi8_r':                       'KOI8-R',
    676     'koi8_u':                       'KOI8-U',
    677     # XXX This list is still incomplete. If you know more
    678     # mappings, please file a bug report. Thanks.
    679 }
    680 
    681 #
    682 # The locale_alias table maps lowercase alias names to C locale names
    683 # (case-sensitive). Encodings are always separated from the locale
    684 # name using a dot ('.'); they should only be given in case the
    685 # language name is needed to interpret the given encoding alias
    686 # correctly (CJK codes often have this need).
    687 #
    688 # Note that the normalize() function which uses this tables
    689 # removes '_' and '-' characters from the encoding part of the
    690 # locale name before doing the lookup. This saves a lot of
    691 # space in the table.
    692 #
    693 # MAL 2004-12-10:
    694 # Updated alias mapping to most recent locale.alias file
    695 # from X.org distribution using makelocalealias.py.
    696 #
    697 # These are the differences compared to the old mapping (Python 2.4
    698 # and older):
    699 #
    700 #    updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
    701 #    updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
    702 #    updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
    703 #    updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
    704 #    updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
    705 #    updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
    706 #    updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
    707 #    updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
    708 #    updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
    709 #    updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
    710 #    updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
    711 #    updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
    712 #    updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
    713 #    updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
    714 #    updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
    715 #    updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
    716 #    updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
    717 #    updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
    718 #    updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
    719 #    updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
    720 #    updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
    721 #    updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
    722 #
    723 # MAL 2008-05-30:
    724 # Updated alias mapping to most recent locale.alias file
    725 # from X.org distribution using makelocalealias.py.
    726 #
    727 # These are the differences compared to the old mapping (Python 2.5
    728 # and older):
    729 #
    730 #    updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'
    731 #    updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
    732 #    updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
    733 #    updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'
    734 #    updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
    735 #    updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
    736 #    updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    737 #    updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    738 #    updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    739 #    updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    740 #    updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'
    741 #    updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    742 #    updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
    743 #    updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
    744 #    updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    745 #    updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    746 #    updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
    747 #    updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
    748 #    updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
    749 #
    750 # AP 2010-04-12:
    751 # Updated alias mapping to most recent locale.alias file
    752 # from X.org distribution using makelocalealias.py.
    753 #
    754 # These are the differences compared to the old mapping (Python 2.6.5
    755 # and older):
    756 #
    757 #    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
    758 #    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
    759 #    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
    760 #    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
    761 #    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
    762 #    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
    763 #    updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
    764 #    updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
    765 #    updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'
    766 #    updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
    767 #    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'
    768 #    updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
    769 #    updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
    770 #
    771 # SS 2013-12-20:
    772 # Updated alias mapping to most recent locale.alias file
    773 # from X.org distribution using makelocalealias.py.
    774 #
    775 # These are the differences compared to the old mapping (Python 2.7.6
    776 # and older):
    777 #
    778 #    updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
    779 #    updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
    780 #    updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
    781 #    updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
    782 #    updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
    783 #    updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
    784 #    updated 'sd' -> 'sd_IN (at] devanagari.UTF-8' to 'sd_IN.UTF-8'
    785 #    updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
    786 #    updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'
    787 #    updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
    788 #    updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
    789 #
    790 # SS 2014-10-01:
    791 # Updated alias mapping with glibc 2.19 supported locales.
    792 
    793 locale_alias = {
    794     'a3':                                   'az_AZ.KOI8-C',
    795     'a3_az':                                'az_AZ.KOI8-C',
    796     'a3_az.koi8c':                          'az_AZ.KOI8-C',
    797     'a3_az.koic':                           'az_AZ.KOI8-C',
    798     'aa_dj':                                'aa_DJ.ISO8859-1',
    799     'aa_er':                                'aa_ER.UTF-8',
    800     'aa_et':                                'aa_ET.UTF-8',
    801     'af':                                   'af_ZA.ISO8859-1',
    802     'af_za':                                'af_ZA.ISO8859-1',
    803     'af_za.iso88591':                       'af_ZA.ISO8859-1',
    804     'am':                                   'am_ET.UTF-8',
    805     'am_et':                                'am_ET.UTF-8',
    806     'american':                             'en_US.ISO8859-1',
    807     'american.iso88591':                    'en_US.ISO8859-1',
    808     'an_es':                                'an_ES.ISO8859-15',
    809     'ar':                                   'ar_AA.ISO8859-6',
    810     'ar_aa':                                'ar_AA.ISO8859-6',
    811     'ar_aa.iso88596':                       'ar_AA.ISO8859-6',
    812     'ar_ae':                                'ar_AE.ISO8859-6',
    813     'ar_ae.iso88596':                       'ar_AE.ISO8859-6',
    814     'ar_bh':                                'ar_BH.ISO8859-6',
    815     'ar_bh.iso88596':                       'ar_BH.ISO8859-6',
    816     'ar_dz':                                'ar_DZ.ISO8859-6',
    817     'ar_dz.iso88596':                       'ar_DZ.ISO8859-6',
    818     'ar_eg':                                'ar_EG.ISO8859-6',
    819     'ar_eg.iso88596':                       'ar_EG.ISO8859-6',
    820     'ar_in':                                'ar_IN.UTF-8',
    821     'ar_iq':                                'ar_IQ.ISO8859-6',
    822     'ar_iq.iso88596':                       'ar_IQ.ISO8859-6',
    823     'ar_jo':                                'ar_JO.ISO8859-6',
    824     'ar_jo.iso88596':                       'ar_JO.ISO8859-6',
    825     'ar_kw':                                'ar_KW.ISO8859-6',
    826     'ar_kw.iso88596':                       'ar_KW.ISO8859-6',
    827     'ar_lb':                                'ar_LB.ISO8859-6',
    828     'ar_lb.iso88596':                       'ar_LB.ISO8859-6',
    829     'ar_ly':                                'ar_LY.ISO8859-6',
    830     'ar_ly.iso88596':                       'ar_LY.ISO8859-6',
    831     'ar_ma':                                'ar_MA.ISO8859-6',
    832     'ar_ma.iso88596':                       'ar_MA.ISO8859-6',
    833     'ar_om':                                'ar_OM.ISO8859-6',
    834     'ar_om.iso88596':                       'ar_OM.ISO8859-6',
    835     'ar_qa':                                'ar_QA.ISO8859-6',
    836     'ar_qa.iso88596':                       'ar_QA.ISO8859-6',
    837     'ar_sa':                                'ar_SA.ISO8859-6',
    838     'ar_sa.iso88596':                       'ar_SA.ISO8859-6',
    839     'ar_sd':                                'ar_SD.ISO8859-6',
    840     'ar_sd.iso88596':                       'ar_SD.ISO8859-6',
    841     'ar_sy':                                'ar_SY.ISO8859-6',
    842     'ar_sy.iso88596':                       'ar_SY.ISO8859-6',
    843     'ar_tn':                                'ar_TN.ISO8859-6',
    844     'ar_tn.iso88596':                       'ar_TN.ISO8859-6',
    845     'ar_ye':                                'ar_YE.ISO8859-6',
    846     'ar_ye.iso88596':                       'ar_YE.ISO8859-6',
    847     'arabic':                               'ar_AA.ISO8859-6',
    848     'arabic.iso88596':                      'ar_AA.ISO8859-6',
    849     'as':                                   'as_IN.UTF-8',
    850     'as_in':                                'as_IN.UTF-8',
    851     'ast_es':                               'ast_ES.ISO8859-15',
    852     'ayc_pe':                               'ayc_PE.UTF-8',
    853     'az':                                   'az_AZ.ISO8859-9E',
    854     'az_az':                                'az_AZ.ISO8859-9E',
    855     'az_az.iso88599e':                      'az_AZ.ISO8859-9E',
    856     'be':                                   'be_BY.CP1251',
    857     'be@latin':                             'be_BY.UTF-8@latin',
    858     'be_bg.utf8':                           'bg_BG.UTF-8',
    859     'be_by':                                'be_BY.CP1251',
    860     'be_by.cp1251':                         'be_BY.CP1251',
    861     'be_by.microsoftcp1251':                'be_BY.CP1251',
    862     'be_by.utf8@latin':                     'be_BY.UTF-8@latin',
    863     'be_by@latin':                          'be_BY.UTF-8@latin',
    864     'bem_zm':                               'bem_ZM.UTF-8',
    865     'ber_dz':                               'ber_DZ.UTF-8',
    866     'ber_ma':                               'ber_MA.UTF-8',
    867     'bg':                                   'bg_BG.CP1251',
    868     'bg_bg':                                'bg_BG.CP1251',
    869     'bg_bg.cp1251':                         'bg_BG.CP1251',
    870     'bg_bg.iso88595':                       'bg_BG.ISO8859-5',
    871     'bg_bg.koi8r':                          'bg_BG.KOI8-R',
    872     'bg_bg.microsoftcp1251':                'bg_BG.CP1251',
    873     'bho_in':                               'bho_IN.UTF-8',
    874     'bn_bd':                                'bn_BD.UTF-8',
    875     'bn_in':                                'bn_IN.UTF-8',
    876     'bo_cn':                                'bo_CN.UTF-8',
    877     'bo_in':                                'bo_IN.UTF-8',
    878     'bokmal':                               'nb_NO.ISO8859-1',
    879     'bokm\xe5l':                            'nb_NO.ISO8859-1',
    880     'br':                                   'br_FR.ISO8859-1',
    881     'br_fr':                                'br_FR.ISO8859-1',
    882     'br_fr.iso88591':                       'br_FR.ISO8859-1',
    883     'br_fr.iso885914':                      'br_FR.ISO8859-14',
    884     'br_fr.iso885915':                      'br_FR.ISO8859-15',
    885     'br_fr.iso885915@euro':                 'br_FR.ISO8859-15',
    886     'br_fr.utf8@euro':                      'br_FR.UTF-8',
    887     'br_fr@euro':                           'br_FR.ISO8859-15',
    888     'brx_in':                               'brx_IN.UTF-8',
    889     'bs':                                   'bs_BA.ISO8859-2',
    890     'bs_ba':                                'bs_BA.ISO8859-2',
    891     'bs_ba.iso88592':                       'bs_BA.ISO8859-2',
    892     'bulgarian':                            'bg_BG.CP1251',
    893     'byn_er':                               'byn_ER.UTF-8',
    894     'c':                                    'C',
    895     'c-french':                             'fr_CA.ISO8859-1',
    896     'c-french.iso88591':                    'fr_CA.ISO8859-1',
    897     'c.ascii':                              'C',
    898     'c.en':                                 'C',
    899     'c.iso88591':                           'en_US.ISO8859-1',
    900     'c.utf8':                               'en_US.UTF-8',
    901     'c_c':                                  'C',
    902     'c_c.c':                                'C',
    903     'ca':                                   'ca_ES.ISO8859-1',
    904     'ca_ad':                                'ca_AD.ISO8859-1',
    905     'ca_ad.iso88591':                       'ca_AD.ISO8859-1',
    906     'ca_ad.iso885915':                      'ca_AD.ISO8859-15',
    907     'ca_ad.iso885915@euro':                 'ca_AD.ISO8859-15',
    908     'ca_ad.utf8@euro':                      'ca_AD.UTF-8',
    909     'ca_ad@euro':                           'ca_AD.ISO8859-15',
    910     'ca_es':                                'ca_ES.ISO8859-1',
    911     'ca_es.iso88591':                       'ca_ES.ISO8859-1',
    912     'ca_es.iso885915':                      'ca_ES.ISO8859-15',
    913     'ca_es.iso885915@euro':                 'ca_ES.ISO8859-15',
    914     'ca_es.utf8@euro':                      'ca_ES.UTF-8',
    915     'ca_es@valencia':                       'ca_ES.ISO8859-15@valencia',
    916     'ca_es@euro':                           'ca_ES.ISO8859-15',
    917     'ca_fr':                                'ca_FR.ISO8859-1',
    918     'ca_fr.iso88591':                       'ca_FR.ISO8859-1',
    919     'ca_fr.iso885915':                      'ca_FR.ISO8859-15',
    920     'ca_fr.iso885915@euro':                 'ca_FR.ISO8859-15',
    921     'ca_fr.utf8@euro':                      'ca_FR.UTF-8',
    922     'ca_fr@euro':                           'ca_FR.ISO8859-15',
    923     'ca_it':                                'ca_IT.ISO8859-1',
    924     'ca_it.iso88591':                       'ca_IT.ISO8859-1',
    925     'ca_it.iso885915':                      'ca_IT.ISO8859-15',
    926     'ca_it.iso885915@euro':                 'ca_IT.ISO8859-15',
    927     'ca_it.utf8@euro':                      'ca_IT.UTF-8',
    928     'ca_it@euro':                           'ca_IT.ISO8859-15',
    929     'catalan':                              'ca_ES.ISO8859-1',
    930     'cextend':                              'en_US.ISO8859-1',
    931     'cextend.en':                           'en_US.ISO8859-1',
    932     'chinese-s':                            'zh_CN.eucCN',
    933     'chinese-t':                            'zh_TW.eucTW',
    934     'crh_ua':                               'crh_UA.UTF-8',
    935     'croatian':                             'hr_HR.ISO8859-2',
    936     'cs':                                   'cs_CZ.ISO8859-2',
    937     'cs_cs':                                'cs_CZ.ISO8859-2',
    938     'cs_cs.iso88592':                       'cs_CZ.ISO8859-2',
    939     'cs_cz':                                'cs_CZ.ISO8859-2',
    940     'cs_cz.iso88592':                       'cs_CZ.ISO8859-2',
    941     'csb_pl':                               'csb_PL.UTF-8',
    942     'cv_ru':                                'cv_RU.UTF-8',
    943     'cy':                                   'cy_GB.ISO8859-1',
    944     'cy_gb':                                'cy_GB.ISO8859-1',
    945     'cy_gb.iso88591':                       'cy_GB.ISO8859-1',
    946     'cy_gb.iso885914':                      'cy_GB.ISO8859-14',
    947     'cy_gb.iso885915':                      'cy_GB.ISO8859-15',
    948     'cy_gb@euro':                           'cy_GB.ISO8859-15',
    949     'cz':                                   'cs_CZ.ISO8859-2',
    950     'cz_cz':                                'cs_CZ.ISO8859-2',
    951     'czech':                                'cs_CZ.ISO8859-2',
    952     'da':                                   'da_DK.ISO8859-1',
    953     'da.iso885915':                         'da_DK.ISO8859-15',
    954     'da_dk':                                'da_DK.ISO8859-1',
    955     'da_dk.88591':                          'da_DK.ISO8859-1',
    956     'da_dk.885915':                         'da_DK.ISO8859-15',
    957     'da_dk.iso88591':                       'da_DK.ISO8859-1',
    958     'da_dk.iso885915':                      'da_DK.ISO8859-15',
    959     'da_dk@euro':                           'da_DK.ISO8859-15',
    960     'danish':                               'da_DK.ISO8859-1',
    961     'danish.iso88591':                      'da_DK.ISO8859-1',
    962     'dansk':                                'da_DK.ISO8859-1',
    963     'de':                                   'de_DE.ISO8859-1',
    964     'de.iso885915':                         'de_DE.ISO8859-15',
    965     'de_at':                                'de_AT.ISO8859-1',
    966     'de_at.iso88591':                       'de_AT.ISO8859-1',
    967     'de_at.iso885915':                      'de_AT.ISO8859-15',
    968     'de_at.iso885915@euro':                 'de_AT.ISO8859-15',
    969     'de_at.utf8@euro':                      'de_AT.UTF-8',
    970     'de_at@euro':                           'de_AT.ISO8859-15',
    971     'de_be':                                'de_BE.ISO8859-1',
    972     'de_be.iso88591':                       'de_BE.ISO8859-1',
    973     'de_be.iso885915':                      'de_BE.ISO8859-15',
    974     'de_be.iso885915@euro':                 'de_BE.ISO8859-15',
    975     'de_be.utf8@euro':                      'de_BE.UTF-8',
    976     'de_be@euro':                           'de_BE.ISO8859-15',
    977     'de_ch':                                'de_CH.ISO8859-1',
    978     'de_ch.iso88591':                       'de_CH.ISO8859-1',
    979     'de_ch.iso885915':                      'de_CH.ISO8859-15',
    980     'de_ch@euro':                           'de_CH.ISO8859-15',
    981     'de_de':                                'de_DE.ISO8859-1',
    982     'de_de.88591':                          'de_DE.ISO8859-1',
    983     'de_de.885915':                         'de_DE.ISO8859-15',
    984     'de_de.885915@euro':                    'de_DE.ISO8859-15',
    985     'de_de.iso88591':                       'de_DE.ISO8859-1',
    986     'de_de.iso885915':                      'de_DE.ISO8859-15',
    987     'de_de.iso885915@euro':                 'de_DE.ISO8859-15',
    988     'de_de.utf8@euro':                      'de_DE.UTF-8',
    989     'de_de@euro':                           'de_DE.ISO8859-15',
    990     'de_li.utf8':                           'de_LI.UTF-8',
    991     'de_lu':                                'de_LU.ISO8859-1',
    992     'de_lu.iso88591':                       'de_LU.ISO8859-1',
    993     'de_lu.iso885915':                      'de_LU.ISO8859-15',
    994     'de_lu.iso885915@euro':                 'de_LU.ISO8859-15',
    995     'de_lu.utf8@euro':                      'de_LU.UTF-8',
    996     'de_lu@euro':                           'de_LU.ISO8859-15',
    997     'deutsch':                              'de_DE.ISO8859-1',
    998     'doi_in':                               'doi_IN.UTF-8',
    999     'dutch':                                'nl_NL.ISO8859-1',
   1000     'dutch.iso88591':                       'nl_BE.ISO8859-1',
   1001     'dv_mv':                                'dv_MV.UTF-8',
   1002     'dz_bt':                                'dz_BT.UTF-8',
   1003     'ee':                                   'ee_EE.ISO8859-4',
   1004     'ee_ee':                                'ee_EE.ISO8859-4',
   1005     'ee_ee.iso88594':                       'ee_EE.ISO8859-4',
   1006     'eesti':                                'et_EE.ISO8859-1',
   1007     'el':                                   'el_GR.ISO8859-7',
   1008     'el_cy':                                'el_CY.ISO8859-7',
   1009     'el_gr':                                'el_GR.ISO8859-7',
   1010     'el_gr.iso88597':                       'el_GR.ISO8859-7',
   1011     'el_gr@euro':                           'el_GR.ISO8859-15',
   1012     'en':                                   'en_US.ISO8859-1',
   1013     'en.iso88591':                          'en_US.ISO8859-1',
   1014     'en_ag':                                'en_AG.UTF-8',
   1015     'en_au':                                'en_AU.ISO8859-1',
   1016     'en_au.iso88591':                       'en_AU.ISO8859-1',
   1017     'en_be':                                'en_BE.ISO8859-1',
   1018     'en_be@euro':                           'en_BE.ISO8859-15',
   1019     'en_bw':                                'en_BW.ISO8859-1',
   1020     'en_bw.iso88591':                       'en_BW.ISO8859-1',
   1021     'en_ca':                                'en_CA.ISO8859-1',
   1022     'en_ca.iso88591':                       'en_CA.ISO8859-1',
   1023     'en_dk':                                'en_DK.ISO8859-1',
   1024     'en_dl.utf8':                           'en_DL.UTF-8',
   1025     'en_gb':                                'en_GB.ISO8859-1',
   1026     'en_gb.88591':                          'en_GB.ISO8859-1',
   1027     'en_gb.iso88591':                       'en_GB.ISO8859-1',
   1028     'en_gb.iso885915':                      'en_GB.ISO8859-15',
   1029     'en_gb@euro':                           'en_GB.ISO8859-15',
   1030     'en_hk':                                'en_HK.ISO8859-1',
   1031     'en_hk.iso88591':                       'en_HK.ISO8859-1',
   1032     'en_ie':                                'en_IE.ISO8859-1',
   1033     'en_ie.iso88591':                       'en_IE.ISO8859-1',
   1034     'en_ie.iso885915':                      'en_IE.ISO8859-15',
   1035     'en_ie.iso885915@euro':                 'en_IE.ISO8859-15',
   1036     'en_ie.utf8@euro':                      'en_IE.UTF-8',
   1037     'en_ie@euro':                           'en_IE.ISO8859-15',
   1038     'en_in':                                'en_IN.ISO8859-1',
   1039     'en_ng':                                'en_NG.UTF-8',
   1040     'en_nz':                                'en_NZ.ISO8859-1',
   1041     'en_nz.iso88591':                       'en_NZ.ISO8859-1',
   1042     'en_ph':                                'en_PH.ISO8859-1',
   1043     'en_ph.iso88591':                       'en_PH.ISO8859-1',
   1044     'en_sg':                                'en_SG.ISO8859-1',
   1045     'en_sg.iso88591':                       'en_SG.ISO8859-1',
   1046     'en_uk':                                'en_GB.ISO8859-1',
   1047     'en_us':                                'en_US.ISO8859-1',
   1048     'en_us.88591':                          'en_US.ISO8859-1',
   1049     'en_us.885915':                         'en_US.ISO8859-15',
   1050     'en_us.iso88591':                       'en_US.ISO8859-1',
   1051     'en_us.iso885915':                      'en_US.ISO8859-15',
   1052     'en_us.iso885915@euro':                 'en_US.ISO8859-15',
   1053     'en_us@euro':                           'en_US.ISO8859-15',
   1054     'en_us@euro@euro':                      'en_US.ISO8859-15',
   1055     'en_za':                                'en_ZA.ISO8859-1',
   1056     'en_za.88591':                          'en_ZA.ISO8859-1',
   1057     'en_za.iso88591':                       'en_ZA.ISO8859-1',
   1058     'en_za.iso885915':                      'en_ZA.ISO8859-15',
   1059     'en_za@euro':                           'en_ZA.ISO8859-15',
   1060     'en_zm':                                'en_ZM.UTF-8',
   1061     'en_zw':                                'en_ZW.ISO8859-1',
   1062     'en_zw.iso88591':                       'en_ZW.ISO8859-1',
   1063     'en_zw.utf8':                           'en_ZS.UTF-8',
   1064     'eng_gb':                               'en_GB.ISO8859-1',
   1065     'eng_gb.8859':                          'en_GB.ISO8859-1',
   1066     'english':                              'en_EN.ISO8859-1',
   1067     'english.iso88591':                     'en_EN.ISO8859-1',
   1068     'english_uk':                           'en_GB.ISO8859-1',
   1069     'english_uk.8859':                      'en_GB.ISO8859-1',
   1070     'english_united-states':                'en_US.ISO8859-1',
   1071     'english_united-states.437':            'C',
   1072     'english_us':                           'en_US.ISO8859-1',
   1073     'english_us.8859':                      'en_US.ISO8859-1',
   1074     'english_us.ascii':                     'en_US.ISO8859-1',
   1075     'eo':                                   'eo_XX.ISO8859-3',
   1076     'eo.utf8':                              'eo.UTF-8',
   1077     'eo_eo':                                'eo_EO.ISO8859-3',
   1078     'eo_eo.iso88593':                       'eo_EO.ISO8859-3',
   1079     'eo_us.utf8':                           'eo_US.UTF-8',
   1080     'eo_xx':                                'eo_XX.ISO8859-3',
   1081     'eo_xx.iso88593':                       'eo_XX.ISO8859-3',
   1082     'es':                                   'es_ES.ISO8859-1',
   1083     'es_ar':                                'es_AR.ISO8859-1',
   1084     'es_ar.iso88591':                       'es_AR.ISO8859-1',
   1085     'es_bo':                                'es_BO.ISO8859-1',
   1086     'es_bo.iso88591':                       'es_BO.ISO8859-1',
   1087     'es_cl':                                'es_CL.ISO8859-1',
   1088     'es_cl.iso88591':                       'es_CL.ISO8859-1',
   1089     'es_co':                                'es_CO.ISO8859-1',
   1090     'es_co.iso88591':                       'es_CO.ISO8859-1',
   1091     'es_cr':                                'es_CR.ISO8859-1',
   1092     'es_cr.iso88591':                       'es_CR.ISO8859-1',
   1093     'es_cu':                                'es_CU.UTF-8',
   1094     'es_do':                                'es_DO.ISO8859-1',
   1095     'es_do.iso88591':                       'es_DO.ISO8859-1',
   1096     'es_ec':                                'es_EC.ISO8859-1',
   1097     'es_ec.iso88591':                       'es_EC.ISO8859-1',
   1098     'es_es':                                'es_ES.ISO8859-1',
   1099     'es_es.88591':                          'es_ES.ISO8859-1',
   1100     'es_es.iso88591':                       'es_ES.ISO8859-1',
   1101     'es_es.iso885915':                      'es_ES.ISO8859-15',
   1102     'es_es.iso885915@euro':                 'es_ES.ISO8859-15',
   1103     'es_es.utf8@euro':                      'es_ES.UTF-8',
   1104     'es_es@euro':                           'es_ES.ISO8859-15',
   1105     'es_gt':                                'es_GT.ISO8859-1',
   1106     'es_gt.iso88591':                       'es_GT.ISO8859-1',
   1107     'es_hn':                                'es_HN.ISO8859-1',
   1108     'es_hn.iso88591':                       'es_HN.ISO8859-1',
   1109     'es_mx':                                'es_MX.ISO8859-1',
   1110     'es_mx.iso88591':                       'es_MX.ISO8859-1',
   1111     'es_ni':                                'es_NI.ISO8859-1',
   1112     'es_ni.iso88591':                       'es_NI.ISO8859-1',
   1113     'es_pa':                                'es_PA.ISO8859-1',
   1114     'es_pa.iso88591':                       'es_PA.ISO8859-1',
   1115     'es_pa.iso885915':                      'es_PA.ISO8859-15',
   1116     'es_pa@euro':                           'es_PA.ISO8859-15',
   1117     'es_pe':                                'es_PE.ISO8859-1',
   1118     'es_pe.iso88591':                       'es_PE.ISO8859-1',
   1119     'es_pe.iso885915':                      'es_PE.ISO8859-15',
   1120     'es_pe@euro':                           'es_PE.ISO8859-15',
   1121     'es_pr':                                'es_PR.ISO8859-1',
   1122     'es_pr.iso88591':                       'es_PR.ISO8859-1',
   1123     'es_py':                                'es_PY.ISO8859-1',
   1124     'es_py.iso88591':                       'es_PY.ISO8859-1',
   1125     'es_py.iso885915':                      'es_PY.ISO8859-15',
   1126     'es_py@euro':                           'es_PY.ISO8859-15',
   1127     'es_sv':                                'es_SV.ISO8859-1',
   1128     'es_sv.iso88591':                       'es_SV.ISO8859-1',
   1129     'es_sv.iso885915':                      'es_SV.ISO8859-15',
   1130     'es_sv@euro':                           'es_SV.ISO8859-15',
   1131     'es_us':                                'es_US.ISO8859-1',
   1132     'es_us.iso88591':                       'es_US.ISO8859-1',
   1133     'es_uy':                                'es_UY.ISO8859-1',
   1134     'es_uy.iso88591':                       'es_UY.ISO8859-1',
   1135     'es_uy.iso885915':                      'es_UY.ISO8859-15',
   1136     'es_uy@euro':                           'es_UY.ISO8859-15',
   1137     'es_ve':                                'es_VE.ISO8859-1',
   1138     'es_ve.iso88591':                       'es_VE.ISO8859-1',
   1139     'es_ve.iso885915':                      'es_VE.ISO8859-15',
   1140     'es_ve@euro':                           'es_VE.ISO8859-15',
   1141     'estonian':                             'et_EE.ISO8859-1',
   1142     'et':                                   'et_EE.ISO8859-15',
   1143     'et_ee':                                'et_EE.ISO8859-15',
   1144     'et_ee.iso88591':                       'et_EE.ISO8859-1',
   1145     'et_ee.iso885913':                      'et_EE.ISO8859-13',
   1146     'et_ee.iso885915':                      'et_EE.ISO8859-15',
   1147     'et_ee.iso88594':                       'et_EE.ISO8859-4',
   1148     'et_ee@euro':                           'et_EE.ISO8859-15',
   1149     'eu':                                   'eu_ES.ISO8859-1',
   1150     'eu_es':                                'eu_ES.ISO8859-1',
   1151     'eu_es.iso88591':                       'eu_ES.ISO8859-1',
   1152     'eu_es.iso885915':                      'eu_ES.ISO8859-15',
   1153     'eu_es.iso885915@euro':                 'eu_ES.ISO8859-15',
   1154     'eu_es.utf8@euro':                      'eu_ES.UTF-8',
   1155     'eu_es@euro':                           'eu_ES.ISO8859-15',
   1156     'eu_fr':                                'eu_FR.ISO8859-1',
   1157     'fa':                                   'fa_IR.UTF-8',
   1158     'fa_ir':                                'fa_IR.UTF-8',
   1159     'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',
   1160     'ff_sn':                                'ff_SN.UTF-8',
   1161     'fi':                                   'fi_FI.ISO8859-15',
   1162     'fi.iso885915':                         'fi_FI.ISO8859-15',
   1163     'fi_fi':                                'fi_FI.ISO8859-15',
   1164     'fi_fi.88591':                          'fi_FI.ISO8859-1',
   1165     'fi_fi.iso88591':                       'fi_FI.ISO8859-1',
   1166     'fi_fi.iso885915':                      'fi_FI.ISO8859-15',
   1167     'fi_fi.iso885915@euro':                 'fi_FI.ISO8859-15',
   1168     'fi_fi.utf8@euro':                      'fi_FI.UTF-8',
   1169     'fi_fi@euro':                           'fi_FI.ISO8859-15',
   1170     'fil_ph':                               'fil_PH.UTF-8',
   1171     'finnish':                              'fi_FI.ISO8859-1',
   1172     'finnish.iso88591':                     'fi_FI.ISO8859-1',
   1173     'fo':                                   'fo_FO.ISO8859-1',
   1174     'fo_fo':                                'fo_FO.ISO8859-1',
   1175     'fo_fo.iso88591':                       'fo_FO.ISO8859-1',
   1176     'fo_fo.iso885915':                      'fo_FO.ISO8859-15',
   1177     'fo_fo@euro':                           'fo_FO.ISO8859-15',
   1178     'fr':                                   'fr_FR.ISO8859-1',
   1179     'fr.iso885915':                         'fr_FR.ISO8859-15',
   1180     'fr_be':                                'fr_BE.ISO8859-1',
   1181     'fr_be.88591':                          'fr_BE.ISO8859-1',
   1182     'fr_be.iso88591':                       'fr_BE.ISO8859-1',
   1183     'fr_be.iso885915':                      'fr_BE.ISO8859-15',
   1184     'fr_be.iso885915@euro':                 'fr_BE.ISO8859-15',
   1185     'fr_be.utf8@euro':                      'fr_BE.UTF-8',
   1186     'fr_be@euro':                           'fr_BE.ISO8859-15',
   1187     'fr_ca':                                'fr_CA.ISO8859-1',
   1188     'fr_ca.88591':                          'fr_CA.ISO8859-1',
   1189     'fr_ca.iso88591':                       'fr_CA.ISO8859-1',
   1190     'fr_ca.iso885915':                      'fr_CA.ISO8859-15',
   1191     'fr_ca@euro':                           'fr_CA.ISO8859-15',
   1192     'fr_ch':                                'fr_CH.ISO8859-1',
   1193     'fr_ch.88591':                          'fr_CH.ISO8859-1',
   1194     'fr_ch.iso88591':                       'fr_CH.ISO8859-1',
   1195     'fr_ch.iso885915':                      'fr_CH.ISO8859-15',
   1196     'fr_ch@euro':                           'fr_CH.ISO8859-15',
   1197     'fr_fr':                                'fr_FR.ISO8859-1',
   1198     'fr_fr.88591':                          'fr_FR.ISO8859-1',
   1199     'fr_fr.iso88591':                       'fr_FR.ISO8859-1',
   1200     'fr_fr.iso885915':                      'fr_FR.ISO8859-15',
   1201     'fr_fr.iso885915@euro':                 'fr_FR.ISO8859-15',
   1202     'fr_fr.utf8@euro':                      'fr_FR.UTF-8',
   1203     'fr_fr@euro':                           'fr_FR.ISO8859-15',
   1204     'fr_lu':                                'fr_LU.ISO8859-1',
   1205     'fr_lu.88591':                          'fr_LU.ISO8859-1',
   1206     'fr_lu.iso88591':                       'fr_LU.ISO8859-1',
   1207     'fr_lu.iso885915':                      'fr_LU.ISO8859-15',
   1208     'fr_lu.iso885915@euro':                 'fr_LU.ISO8859-15',
   1209     'fr_lu.utf8@euro':                      'fr_LU.UTF-8',
   1210     'fr_lu@euro':                           'fr_LU.ISO8859-15',
   1211     'fran\xe7ais':                          'fr_FR.ISO8859-1',
   1212     'fre_fr':                               'fr_FR.ISO8859-1',
   1213     'fre_fr.8859':                          'fr_FR.ISO8859-1',
   1214     'french':                               'fr_FR.ISO8859-1',
   1215     'french.iso88591':                      'fr_CH.ISO8859-1',
   1216     'french_france':                        'fr_FR.ISO8859-1',
   1217     'french_france.8859':                   'fr_FR.ISO8859-1',
   1218     'fur_it':                               'fur_IT.UTF-8',
   1219     'fy_de':                                'fy_DE.UTF-8',
   1220     'fy_nl':                                'fy_NL.UTF-8',
   1221     'ga':                                   'ga_IE.ISO8859-1',
   1222     'ga_ie':                                'ga_IE.ISO8859-1',
   1223     'ga_ie.iso88591':                       'ga_IE.ISO8859-1',
   1224     'ga_ie.iso885914':                      'ga_IE.ISO8859-14',
   1225     'ga_ie.iso885915':                      'ga_IE.ISO8859-15',
   1226     'ga_ie.iso885915@euro':                 'ga_IE.ISO8859-15',
   1227     'ga_ie.utf8@euro':                      'ga_IE.UTF-8',
   1228     'ga_ie@euro':                           'ga_IE.ISO8859-15',
   1229     'galego':                               'gl_ES.ISO8859-1',
   1230     'galician':                             'gl_ES.ISO8859-1',
   1231     'gd':                                   'gd_GB.ISO8859-1',
   1232     'gd_gb':                                'gd_GB.ISO8859-1',
   1233     'gd_gb.iso88591':                       'gd_GB.ISO8859-1',
   1234     'gd_gb.iso885914':                      'gd_GB.ISO8859-14',
   1235     'gd_gb.iso885915':                      'gd_GB.ISO8859-15',
   1236     'gd_gb@euro':                           'gd_GB.ISO8859-15',
   1237     'ger_de':                               'de_DE.ISO8859-1',
   1238     'ger_de.8859':                          'de_DE.ISO8859-1',
   1239     'german':                               'de_DE.ISO8859-1',
   1240     'german.iso88591':                      'de_CH.ISO8859-1',
   1241     'german_germany':                       'de_DE.ISO8859-1',
   1242     'german_germany.8859':                  'de_DE.ISO8859-1',
   1243     'gez_er':                               'gez_ER.UTF-8',
   1244     'gez_et':                               'gez_ET.UTF-8',
   1245     'gl':                                   'gl_ES.ISO8859-1',
   1246     'gl_es':                                'gl_ES.ISO8859-1',
   1247     'gl_es.iso88591':                       'gl_ES.ISO8859-1',
   1248     'gl_es.iso885915':                      'gl_ES.ISO8859-15',
   1249     'gl_es.iso885915@euro':                 'gl_ES.ISO8859-15',
   1250     'gl_es.utf8@euro':                      'gl_ES.UTF-8',
   1251     'gl_es@euro':                           'gl_ES.ISO8859-15',
   1252     'greek':                                'el_GR.ISO8859-7',
   1253     'greek.iso88597':                       'el_GR.ISO8859-7',
   1254     'gu_in':                                'gu_IN.UTF-8',
   1255     'gv':                                   'gv_GB.ISO8859-1',
   1256     'gv_gb':                                'gv_GB.ISO8859-1',
   1257     'gv_gb.iso88591':                       'gv_GB.ISO8859-1',
   1258     'gv_gb.iso885914':                      'gv_GB.ISO8859-14',
   1259     'gv_gb.iso885915':                      'gv_GB.ISO8859-15',
   1260     'gv_gb@euro':                           'gv_GB.ISO8859-15',
   1261     'ha_ng':                                'ha_NG.UTF-8',
   1262     'he':                                   'he_IL.ISO8859-8',
   1263     'he_il':                                'he_IL.ISO8859-8',
   1264     'he_il.cp1255':                         'he_IL.CP1255',
   1265     'he_il.iso88598':                       'he_IL.ISO8859-8',
   1266     'he_il.microsoftcp1255':                'he_IL.CP1255',
   1267     'hebrew':                               'he_IL.ISO8859-8',
   1268     'hebrew.iso88598':                      'he_IL.ISO8859-8',
   1269     'hi':                                   'hi_IN.ISCII-DEV',
   1270     'hi_in':                                'hi_IN.ISCII-DEV',
   1271     'hi_in.isciidev':                       'hi_IN.ISCII-DEV',
   1272     'hne':                                  'hne_IN.UTF-8',
   1273     'hne_in':                               'hne_IN.UTF-8',
   1274     'hr':                                   'hr_HR.ISO8859-2',
   1275     'hr_hr':                                'hr_HR.ISO8859-2',
   1276     'hr_hr.iso88592':                       'hr_HR.ISO8859-2',
   1277     'hrvatski':                             'hr_HR.ISO8859-2',
   1278     'hsb_de':                               'hsb_DE.ISO8859-2',
   1279     'ht_ht':                                'ht_HT.UTF-8',
   1280     'hu':                                   'hu_HU.ISO8859-2',
   1281     'hu_hu':                                'hu_HU.ISO8859-2',
   1282     'hu_hu.iso88592':                       'hu_HU.ISO8859-2',
   1283     'hungarian':                            'hu_HU.ISO8859-2',
   1284     'hy_am':                                'hy_AM.UTF-8',
   1285     'hy_am.armscii8':                       'hy_AM.ARMSCII_8',
   1286     'ia':                                   'ia.UTF-8',
   1287     'ia_fr':                                'ia_FR.UTF-8',
   1288     'icelandic':                            'is_IS.ISO8859-1',
   1289     'icelandic.iso88591':                   'is_IS.ISO8859-1',
   1290     'id':                                   'id_ID.ISO8859-1',
   1291     'id_id':                                'id_ID.ISO8859-1',
   1292     'ig_ng':                                'ig_NG.UTF-8',
   1293     'ik_ca':                                'ik_CA.UTF-8',
   1294     'in':                                   'id_ID.ISO8859-1',
   1295     'in_id':                                'id_ID.ISO8859-1',
   1296     'is':                                   'is_IS.ISO8859-1',
   1297     'is_is':                                'is_IS.ISO8859-1',
   1298     'is_is.iso88591':                       'is_IS.ISO8859-1',
   1299     'is_is.iso885915':                      'is_IS.ISO8859-15',
   1300     'is_is@euro':                           'is_IS.ISO8859-15',
   1301     'iso-8859-1':                           'en_US.ISO8859-1',
   1302     'iso-8859-15':                          'en_US.ISO8859-15',
   1303     'iso8859-1':                            'en_US.ISO8859-1',
   1304     'iso8859-15':                           'en_US.ISO8859-15',
   1305     'iso_8859_1':                           'en_US.ISO8859-1',
   1306     'iso_8859_15':                          'en_US.ISO8859-15',
   1307     'it':                                   'it_IT.ISO8859-1',
   1308     'it.iso885915':                         'it_IT.ISO8859-15',
   1309     'it_ch':                                'it_CH.ISO8859-1',
   1310     'it_ch.iso88591':                       'it_CH.ISO8859-1',
   1311     'it_ch.iso885915':                      'it_CH.ISO8859-15',
   1312     'it_ch@euro':                           'it_CH.ISO8859-15',
   1313     'it_it':                                'it_IT.ISO8859-1',
   1314     'it_it.88591':                          'it_IT.ISO8859-1',
   1315     'it_it.iso88591':                       'it_IT.ISO8859-1',
   1316     'it_it.iso885915':                      'it_IT.ISO8859-15',
   1317     'it_it.iso885915@euro':                 'it_IT.ISO8859-15',
   1318     'it_it.utf8@euro':                      'it_IT.UTF-8',
   1319     'it_it@euro':                           'it_IT.ISO8859-15',
   1320     'italian':                              'it_IT.ISO8859-1',
   1321     'italian.iso88591':                     'it_IT.ISO8859-1',
   1322     'iu':                                   'iu_CA.NUNACOM-8',
   1323     'iu_ca':                                'iu_CA.NUNACOM-8',
   1324     'iu_ca.nunacom8':                       'iu_CA.NUNACOM-8',
   1325     'iw':                                   'he_IL.ISO8859-8',
   1326     'iw_il':                                'he_IL.ISO8859-8',
   1327     'iw_il.iso88598':                       'he_IL.ISO8859-8',
   1328     'iw_il.utf8':                           'iw_IL.UTF-8',
   1329     'ja':                                   'ja_JP.eucJP',
   1330     'ja.jis':                               'ja_JP.JIS7',
   1331     'ja.sjis':                              'ja_JP.SJIS',
   1332     'ja_jp':                                'ja_JP.eucJP',
   1333     'ja_jp.ajec':                           'ja_JP.eucJP',
   1334     'ja_jp.euc':                            'ja_JP.eucJP',
   1335     'ja_jp.eucjp':                          'ja_JP.eucJP',
   1336     'ja_jp.iso-2022-jp':                    'ja_JP.JIS7',
   1337     'ja_jp.iso2022jp':                      'ja_JP.JIS7',
   1338     'ja_jp.jis':                            'ja_JP.JIS7',
   1339     'ja_jp.jis7':                           'ja_JP.JIS7',
   1340     'ja_jp.mscode':                         'ja_JP.SJIS',
   1341     'ja_jp.pck':                            'ja_JP.SJIS',
   1342     'ja_jp.sjis':                           'ja_JP.SJIS',
   1343     'ja_jp.ujis':                           'ja_JP.eucJP',
   1344     'japan':                                'ja_JP.eucJP',
   1345     'japanese':                             'ja_JP.eucJP',
   1346     'japanese-euc':                         'ja_JP.eucJP',
   1347     'japanese.euc':                         'ja_JP.eucJP',
   1348     'japanese.sjis':                        'ja_JP.SJIS',
   1349     'jp_jp':                                'ja_JP.eucJP',
   1350     'ka':                                   'ka_GE.GEORGIAN-ACADEMY',
   1351     'ka_ge':                                'ka_GE.GEORGIAN-ACADEMY',
   1352     'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',
   1353     'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',
   1354     'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',
   1355     'kk_kz':                                'kk_KZ.RK1048',
   1356     'kl':                                   'kl_GL.ISO8859-1',
   1357     'kl_gl':                                'kl_GL.ISO8859-1',
   1358     'kl_gl.iso88591':                       'kl_GL.ISO8859-1',
   1359     'kl_gl.iso885915':                      'kl_GL.ISO8859-15',
   1360     'kl_gl@euro':                           'kl_GL.ISO8859-15',
   1361     'km_kh':                                'km_KH.UTF-8',
   1362     'kn':                                   'kn_IN.UTF-8',
   1363     'kn_in':                                'kn_IN.UTF-8',
   1364     'ko':                                   'ko_KR.eucKR',
   1365     'ko_kr':                                'ko_KR.eucKR',
   1366     'ko_kr.euc':                            'ko_KR.eucKR',
   1367     'ko_kr.euckr':                          'ko_KR.eucKR',
   1368     'kok_in':                               'kok_IN.UTF-8',
   1369     'korean':                               'ko_KR.eucKR',
   1370     'korean.euc':                           'ko_KR.eucKR',
   1371     'ks':                                   'ks_IN.UTF-8',
   1372     'ks_in':                                'ks_IN.UTF-8',
   1373     'ks_in@devanagari':                     'ks_IN.UTF-8@devanagari',
   1374     'ks_in (at] devanagari.utf8':                'ks_IN.UTF-8@devanagari',
   1375     'ku_tr':                                'ku_TR.ISO8859-9',
   1376     'kw':                                   'kw_GB.ISO8859-1',
   1377     'kw_gb':                                'kw_GB.ISO8859-1',
   1378     'kw_gb.iso88591':                       'kw_GB.ISO8859-1',
   1379     'kw_gb.iso885914':                      'kw_GB.ISO8859-14',
   1380     'kw_gb.iso885915':                      'kw_GB.ISO8859-15',
   1381     'kw_gb@euro':                           'kw_GB.ISO8859-15',
   1382     'ky':                                   'ky_KG.UTF-8',
   1383     'ky_kg':                                'ky_KG.UTF-8',
   1384     'lb_lu':                                'lb_LU.UTF-8',
   1385     'lg_ug':                                'lg_UG.ISO8859-10',
   1386     'li_be':                                'li_BE.UTF-8',
   1387     'li_nl':                                'li_NL.UTF-8',
   1388     'lij_it':                               'lij_IT.UTF-8',
   1389     'lithuanian':                           'lt_LT.ISO8859-13',
   1390     'lo':                                   'lo_LA.MULELAO-1',
   1391     'lo_la':                                'lo_LA.MULELAO-1',
   1392     'lo_la.cp1133':                         'lo_LA.IBM-CP1133',
   1393     'lo_la.ibmcp1133':                      'lo_LA.IBM-CP1133',
   1394     'lo_la.mulelao1':                       'lo_LA.MULELAO-1',
   1395     'lt':                                   'lt_LT.ISO8859-13',
   1396     'lt_lt':                                'lt_LT.ISO8859-13',
   1397     'lt_lt.iso885913':                      'lt_LT.ISO8859-13',
   1398     'lt_lt.iso88594':                       'lt_LT.ISO8859-4',
   1399     'lv':                                   'lv_LV.ISO8859-13',
   1400     'lv_lv':                                'lv_LV.ISO8859-13',
   1401     'lv_lv.iso885913':                      'lv_LV.ISO8859-13',
   1402     'lv_lv.iso88594':                       'lv_LV.ISO8859-4',
   1403     'mag_in':                               'mag_IN.UTF-8',
   1404     'mai':                                  'mai_IN.UTF-8',
   1405     'mai_in':                               'mai_IN.UTF-8',
   1406     'mg_mg':                                'mg_MG.ISO8859-15',
   1407     'mhr_ru':                               'mhr_RU.UTF-8',
   1408     'mi':                                   'mi_NZ.ISO8859-1',
   1409     'mi_nz':                                'mi_NZ.ISO8859-1',
   1410     'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',
   1411     'mk':                                   'mk_MK.ISO8859-5',
   1412     'mk_mk':                                'mk_MK.ISO8859-5',
   1413     'mk_mk.cp1251':                         'mk_MK.CP1251',
   1414     'mk_mk.iso88595':                       'mk_MK.ISO8859-5',
   1415     'mk_mk.microsoftcp1251':                'mk_MK.CP1251',
   1416     'ml':                                   'ml_IN.UTF-8',
   1417     'ml_in':                                'ml_IN.UTF-8',
   1418     'mn_mn':                                'mn_MN.UTF-8',
   1419     'mni_in':                               'mni_IN.UTF-8',
   1420     'mr':                                   'mr_IN.UTF-8',
   1421     'mr_in':                                'mr_IN.UTF-8',
   1422     'ms':                                   'ms_MY.ISO8859-1',
   1423     'ms_my':                                'ms_MY.ISO8859-1',
   1424     'ms_my.iso88591':                       'ms_MY.ISO8859-1',
   1425     'mt':                                   'mt_MT.ISO8859-3',
   1426     'mt_mt':                                'mt_MT.ISO8859-3',
   1427     'mt_mt.iso88593':                       'mt_MT.ISO8859-3',
   1428     'my_mm':                                'my_MM.UTF-8',
   1429     'nan_tw@latin':                         'nan_TW.UTF-8@latin',
   1430     'nb':                                   'nb_NO.ISO8859-1',
   1431     'nb_no':                                'nb_NO.ISO8859-1',
   1432     'nb_no.88591':                          'nb_NO.ISO8859-1',
   1433     'nb_no.iso88591':                       'nb_NO.ISO8859-1',
   1434     'nb_no.iso885915':                      'nb_NO.ISO8859-15',
   1435     'nb_no@euro':                           'nb_NO.ISO8859-15',
   1436     'nds_de':                               'nds_DE.UTF-8',
   1437     'nds_nl':                               'nds_NL.UTF-8',
   1438     'ne_np':                                'ne_NP.UTF-8',
   1439     'nhn_mx':                               'nhn_MX.UTF-8',
   1440     'niu_nu':                               'niu_NU.UTF-8',
   1441     'niu_nz':                               'niu_NZ.UTF-8',
   1442     'nl':                                   'nl_NL.ISO8859-1',
   1443     'nl.iso885915':                         'nl_NL.ISO8859-15',
   1444     'nl_aw':                                'nl_AW.UTF-8',
   1445     'nl_be':                                'nl_BE.ISO8859-1',
   1446     'nl_be.88591':                          'nl_BE.ISO8859-1',
   1447     'nl_be.iso88591':                       'nl_BE.ISO8859-1',
   1448     'nl_be.iso885915':                      'nl_BE.ISO8859-15',
   1449     'nl_be.iso885915@euro':                 'nl_BE.ISO8859-15',
   1450     'nl_be.utf8@euro':                      'nl_BE.UTF-8',
   1451     'nl_be@euro':                           'nl_BE.ISO8859-15',
   1452     'nl_nl':                                'nl_NL.ISO8859-1',
   1453     'nl_nl.88591':                          'nl_NL.ISO8859-1',
   1454     'nl_nl.iso88591':                       'nl_NL.ISO8859-1',
   1455     'nl_nl.iso885915':                      'nl_NL.ISO8859-15',
   1456     'nl_nl.iso885915@euro':                 'nl_NL.ISO8859-15',
   1457     'nl_nl.utf8@euro':                      'nl_NL.UTF-8',
   1458     'nl_nl@euro':                           'nl_NL.ISO8859-15',
   1459     'nn':                                   'nn_NO.ISO8859-1',
   1460     'nn_no':                                'nn_NO.ISO8859-1',
   1461     'nn_no.88591':                          'nn_NO.ISO8859-1',
   1462     'nn_no.iso88591':                       'nn_NO.ISO8859-1',
   1463     'nn_no.iso885915':                      'nn_NO.ISO8859-15',
   1464     'nn_no@euro':                           'nn_NO.ISO8859-15',
   1465     'no':                                   'no_NO.ISO8859-1',
   1466     'no@nynorsk':                           'ny_NO.ISO8859-1',
   1467     'no_no':                                'no_NO.ISO8859-1',
   1468     'no_no.88591':                          'no_NO.ISO8859-1',
   1469     'no_no.iso88591':                       'no_NO.ISO8859-1',
   1470     'no_no.iso885915':                      'no_NO.ISO8859-15',
   1471     'no_no.iso88591@bokmal':                'no_NO.ISO8859-1',
   1472     'no_no.iso88591@nynorsk':               'no_NO.ISO8859-1',
   1473     'no_no@euro':                           'no_NO.ISO8859-15',
   1474     'norwegian':                            'no_NO.ISO8859-1',
   1475     'norwegian.iso88591':                   'no_NO.ISO8859-1',
   1476     'nr':                                   'nr_ZA.ISO8859-1',
   1477     'nr_za':                                'nr_ZA.ISO8859-1',
   1478     'nr_za.iso88591':                       'nr_ZA.ISO8859-1',
   1479     'nso':                                  'nso_ZA.ISO8859-15',
   1480     'nso_za':                               'nso_ZA.ISO8859-15',
   1481     'nso_za.iso885915':                     'nso_ZA.ISO8859-15',
   1482     'ny':                                   'ny_NO.ISO8859-1',
   1483     'ny_no':                                'ny_NO.ISO8859-1',
   1484     'ny_no.88591':                          'ny_NO.ISO8859-1',
   1485     'ny_no.iso88591':                       'ny_NO.ISO8859-1',
   1486     'ny_no.iso885915':                      'ny_NO.ISO8859-15',
   1487     'ny_no@euro':                           'ny_NO.ISO8859-15',
   1488     'nynorsk':                              'nn_NO.ISO8859-1',
   1489     'oc':                                   'oc_FR.ISO8859-1',
   1490     'oc_fr':                                'oc_FR.ISO8859-1',
   1491     'oc_fr.iso88591':                       'oc_FR.ISO8859-1',
   1492     'oc_fr.iso885915':                      'oc_FR.ISO8859-15',
   1493     'oc_fr@euro':                           'oc_FR.ISO8859-15',
   1494     'om_et':                                'om_ET.UTF-8',
   1495     'om_ke':                                'om_KE.ISO8859-1',
   1496     'or':                                   'or_IN.UTF-8',
   1497     'or_in':                                'or_IN.UTF-8',
   1498     'os_ru':                                'os_RU.UTF-8',
   1499     'pa':                                   'pa_IN.UTF-8',
   1500     'pa_in':                                'pa_IN.UTF-8',
   1501     'pa_pk':                                'pa_PK.UTF-8',
   1502     'pap_an':                               'pap_AN.UTF-8',
   1503     'pd':                                   'pd_US.ISO8859-1',
   1504     'pd_de':                                'pd_DE.ISO8859-1',
   1505     'pd_de.iso88591':                       'pd_DE.ISO8859-1',
   1506     'pd_de.iso885915':                      'pd_DE.ISO8859-15',
   1507     'pd_de@euro':                           'pd_DE.ISO8859-15',
   1508     'pd_us':                                'pd_US.ISO8859-1',
   1509     'pd_us.iso88591':                       'pd_US.ISO8859-1',
   1510     'pd_us.iso885915':                      'pd_US.ISO8859-15',
   1511     'pd_us@euro':                           'pd_US.ISO8859-15',
   1512     'ph':                                   'ph_PH.ISO8859-1',
   1513     'ph_ph':                                'ph_PH.ISO8859-1',
   1514     'ph_ph.iso88591':                       'ph_PH.ISO8859-1',
   1515     'pl':                                   'pl_PL.ISO8859-2',
   1516     'pl_pl':                                'pl_PL.ISO8859-2',
   1517     'pl_pl.iso88592':                       'pl_PL.ISO8859-2',
   1518     'polish':                               'pl_PL.ISO8859-2',
   1519     'portuguese':                           'pt_PT.ISO8859-1',
   1520     'portuguese.iso88591':                  'pt_PT.ISO8859-1',
   1521     'portuguese_brazil':                    'pt_BR.ISO8859-1',
   1522     'portuguese_brazil.8859':               'pt_BR.ISO8859-1',
   1523     'posix':                                'C',
   1524     'posix-utf2':                           'C',
   1525     'pp':                                   'pp_AN.ISO8859-1',
   1526     'pp_an':                                'pp_AN.ISO8859-1',
   1527     'pp_an.iso88591':                       'pp_AN.ISO8859-1',
   1528     'ps_af':                                'ps_AF.UTF-8',
   1529     'pt':                                   'pt_PT.ISO8859-1',
   1530     'pt.iso885915':                         'pt_PT.ISO8859-15',
   1531     'pt_br':                                'pt_BR.ISO8859-1',
   1532     'pt_br.88591':                          'pt_BR.ISO8859-1',
   1533     'pt_br.iso88591':                       'pt_BR.ISO8859-1',
   1534     'pt_br.iso885915':                      'pt_BR.ISO8859-15',
   1535     'pt_br@euro':                           'pt_BR.ISO8859-15',
   1536     'pt_pt':                                'pt_PT.ISO8859-1',
   1537     'pt_pt.88591':                          'pt_PT.ISO8859-1',
   1538     'pt_pt.iso88591':                       'pt_PT.ISO8859-1',
   1539     'pt_pt.iso885915':                      'pt_PT.ISO8859-15',
   1540     'pt_pt.iso885915@euro':                 'pt_PT.ISO8859-15',
   1541     'pt_pt.utf8@euro':                      'pt_PT.UTF-8',
   1542     'pt_pt@euro':                           'pt_PT.ISO8859-15',
   1543     'ro':                                   'ro_RO.ISO8859-2',
   1544     'ro_ro':                                'ro_RO.ISO8859-2',
   1545     'ro_ro.iso88592':                       'ro_RO.ISO8859-2',
   1546     'romanian':                             'ro_RO.ISO8859-2',
   1547     'ru':                                   'ru_RU.UTF-8',
   1548     'ru.koi8r':                             'ru_RU.KOI8-R',
   1549     'ru_ru':                                'ru_RU.UTF-8',
   1550     'ru_ru.cp1251':                         'ru_RU.CP1251',
   1551     'ru_ru.iso88595':                       'ru_RU.ISO8859-5',
   1552     'ru_ru.koi8r':                          'ru_RU.KOI8-R',
   1553     'ru_ru.microsoftcp1251':                'ru_RU.CP1251',
   1554     'ru_ua':                                'ru_UA.KOI8-U',
   1555     'ru_ua.cp1251':                         'ru_UA.CP1251',
   1556     'ru_ua.koi8u':                          'ru_UA.KOI8-U',
   1557     'ru_ua.microsoftcp1251':                'ru_UA.CP1251',
   1558     'rumanian':                             'ro_RO.ISO8859-2',
   1559     'russian':                              'ru_RU.ISO8859-5',
   1560     'rw':                                   'rw_RW.ISO8859-1',
   1561     'rw_rw':                                'rw_RW.ISO8859-1',
   1562     'rw_rw.iso88591':                       'rw_RW.ISO8859-1',
   1563     'sa_in':                                'sa_IN.UTF-8',
   1564     'sat_in':                               'sat_IN.UTF-8',
   1565     'sc_it':                                'sc_IT.UTF-8',
   1566     'sd':                                   'sd_IN.UTF-8',
   1567     'sd@devanagari':                        'sd_IN.UTF-8@devanagari',
   1568     'sd_in':                                'sd_IN.UTF-8',
   1569     'sd_in@devanagari':                     'sd_IN.UTF-8@devanagari',
   1570     'sd_in (at] devanagari.utf8':                'sd_IN.UTF-8@devanagari',
   1571     'sd_pk':                                'sd_PK.UTF-8',
   1572     'se_no':                                'se_NO.UTF-8',
   1573     'serbocroatian':                        'sr_RS.UTF-8@latin',
   1574     'sh':                                   'sr_RS.UTF-8@latin',
   1575     'sh_ba.iso88592@bosnia':                'sr_CS.ISO8859-2',
   1576     'sh_hr':                                'sh_HR.ISO8859-2',
   1577     'sh_hr.iso88592':                       'hr_HR.ISO8859-2',
   1578     'sh_sp':                                'sr_CS.ISO8859-2',
   1579     'sh_yu':                                'sr_RS.UTF-8@latin',
   1580     'shs_ca':                               'shs_CA.UTF-8',
   1581     'si':                                   'si_LK.UTF-8',
   1582     'si_lk':                                'si_LK.UTF-8',
   1583     'sid_et':                               'sid_ET.UTF-8',
   1584     'sinhala':                              'si_LK.UTF-8',
   1585     'sk':                                   'sk_SK.ISO8859-2',
   1586     'sk_sk':                                'sk_SK.ISO8859-2',
   1587     'sk_sk.iso88592':                       'sk_SK.ISO8859-2',
   1588     'sl':                                   'sl_SI.ISO8859-2',
   1589     'sl_cs':                                'sl_CS.ISO8859-2',
   1590     'sl_si':                                'sl_SI.ISO8859-2',
   1591     'sl_si.iso88592':                       'sl_SI.ISO8859-2',
   1592     'slovak':                               'sk_SK.ISO8859-2',
   1593     'slovene':                              'sl_SI.ISO8859-2',
   1594     'slovenian':                            'sl_SI.ISO8859-2',
   1595     'so_dj':                                'so_DJ.ISO8859-1',
   1596     'so_et':                                'so_ET.UTF-8',
   1597     'so_ke':                                'so_KE.ISO8859-1',
   1598     'so_so':                                'so_SO.ISO8859-1',
   1599     'sp':                                   'sr_CS.ISO8859-5',
   1600     'sp_yu':                                'sr_CS.ISO8859-5',
   1601     'spanish':                              'es_ES.ISO8859-1',
   1602     'spanish.iso88591':                     'es_ES.ISO8859-1',
   1603     'spanish_spain':                        'es_ES.ISO8859-1',
   1604     'spanish_spain.8859':                   'es_ES.ISO8859-1',
   1605     'sq':                                   'sq_AL.ISO8859-2',
   1606     'sq_al':                                'sq_AL.ISO8859-2',
   1607     'sq_al.iso88592':                       'sq_AL.ISO8859-2',
   1608     'sq_mk':                                'sq_MK.UTF-8',
   1609     'sr':                                   'sr_RS.UTF-8',
   1610     'sr@cyrillic':                          'sr_RS.UTF-8',
   1611     'sr@latin':                             'sr_RS.UTF-8@latin',
   1612     'sr@latn':                              'sr_CS.UTF-8@latin',
   1613     'sr_cs':                                'sr_CS.UTF-8',
   1614     'sr_cs.iso88592':                       'sr_CS.ISO8859-2',
   1615     'sr_cs.iso88592@latn':                  'sr_CS.ISO8859-2',
   1616     'sr_cs.iso88595':                       'sr_CS.ISO8859-5',
   1617     'sr_cs.utf8@latn':                      'sr_CS.UTF-8@latin',
   1618     'sr_cs@latn':                           'sr_CS.UTF-8@latin',
   1619     'sr_me':                                'sr_ME.UTF-8',
   1620     'sr_rs':                                'sr_RS.UTF-8',
   1621     'sr_rs@latin':                          'sr_RS.UTF-8@latin',
   1622     'sr_rs@latn':                           'sr_RS.UTF-8@latin',
   1623     'sr_sp':                                'sr_CS.ISO8859-2',
   1624     'sr_yu':                                'sr_RS.UTF-8@latin',
   1625     'sr_yu.cp1251@cyrillic':                'sr_CS.CP1251',
   1626     'sr_yu.iso88592':                       'sr_CS.ISO8859-2',
   1627     'sr_yu.iso88595':                       'sr_CS.ISO8859-5',
   1628     'sr_yu.iso88595@cyrillic':              'sr_CS.ISO8859-5',
   1629     'sr_yu.microsoftcp1251@cyrillic':       'sr_CS.CP1251',
   1630     'sr_yu.utf8':                           'sr_RS.UTF-8',
   1631     'sr_yu.utf8@cyrillic':                  'sr_RS.UTF-8',
   1632     'sr_yu@cyrillic':                       'sr_RS.UTF-8',
   1633     'ss':                                   'ss_ZA.ISO8859-1',
   1634     'ss_za':                                'ss_ZA.ISO8859-1',
   1635     'ss_za.iso88591':                       'ss_ZA.ISO8859-1',
   1636     'st':                                   'st_ZA.ISO8859-1',
   1637     'st_za':                                'st_ZA.ISO8859-1',
   1638     'st_za.iso88591':                       'st_ZA.ISO8859-1',
   1639     'sv':                                   'sv_SE.ISO8859-1',
   1640     'sv.iso885915':                         'sv_SE.ISO8859-15',
   1641     'sv_fi':                                'sv_FI.ISO8859-1',
   1642     'sv_fi.iso88591':                       'sv_FI.ISO8859-1',
   1643     'sv_fi.iso885915':                      'sv_FI.ISO8859-15',
   1644     'sv_fi.iso885915@euro':                 'sv_FI.ISO8859-15',
   1645     'sv_fi.utf8@euro':                      'sv_FI.UTF-8',
   1646     'sv_fi@euro':                           'sv_FI.ISO8859-15',
   1647     'sv_se':                                'sv_SE.ISO8859-1',
   1648     'sv_se.88591':                          'sv_SE.ISO8859-1',
   1649     'sv_se.iso88591':                       'sv_SE.ISO8859-1',
   1650     'sv_se.iso885915':                      'sv_SE.ISO8859-15',
   1651     'sv_se@euro':                           'sv_SE.ISO8859-15',
   1652     'sw_ke':                                'sw_KE.UTF-8',
   1653     'sw_tz':                                'sw_TZ.UTF-8',
   1654     'swedish':                              'sv_SE.ISO8859-1',
   1655     'swedish.iso88591':                     'sv_SE.ISO8859-1',
   1656     'szl_pl':                               'szl_PL.UTF-8',
   1657     'ta':                                   'ta_IN.TSCII-0',
   1658     'ta_in':                                'ta_IN.TSCII-0',
   1659     'ta_in.tscii':                          'ta_IN.TSCII-0',
   1660     'ta_in.tscii0':                         'ta_IN.TSCII-0',
   1661     'ta_lk':                                'ta_LK.UTF-8',
   1662     'te':                                   'te_IN.UTF-8',
   1663     'te_in':                                'te_IN.UTF-8',
   1664     'tg':                                   'tg_TJ.KOI8-C',
   1665     'tg_tj':                                'tg_TJ.KOI8-C',
   1666     'tg_tj.koi8c':                          'tg_TJ.KOI8-C',
   1667     'th':                                   'th_TH.ISO8859-11',
   1668     'th_th':                                'th_TH.ISO8859-11',
   1669     'th_th.iso885911':                      'th_TH.ISO8859-11',
   1670     'th_th.tactis':                         'th_TH.TIS620',
   1671     'th_th.tis620':                         'th_TH.TIS620',
   1672     'thai':                                 'th_TH.ISO8859-11',
   1673     'ti_er':                                'ti_ER.UTF-8',
   1674     'ti_et':                                'ti_ET.UTF-8',
   1675     'tig_er':                               'tig_ER.UTF-8',
   1676     'tk_tm':                                'tk_TM.UTF-8',
   1677     'tl':                                   'tl_PH.ISO8859-1',
   1678     'tl_ph':                                'tl_PH.ISO8859-1',
   1679     'tl_ph.iso88591':                       'tl_PH.ISO8859-1',
   1680     'tn':                                   'tn_ZA.ISO8859-15',
   1681     'tn_za':                                'tn_ZA.ISO8859-15',
   1682     'tn_za.iso885915':                      'tn_ZA.ISO8859-15',
   1683     'tr':                                   'tr_TR.ISO8859-9',
   1684     'tr_cy':                                'tr_CY.ISO8859-9',
   1685     'tr_tr':                                'tr_TR.ISO8859-9',
   1686     'tr_tr.iso88599':                       'tr_TR.ISO8859-9',
   1687     'ts':                                   'ts_ZA.ISO8859-1',
   1688     'ts_za':                                'ts_ZA.ISO8859-1',
   1689     'ts_za.iso88591':                       'ts_ZA.ISO8859-1',
   1690     'tt':                                   'tt_RU.TATAR-CYR',
   1691     'tt_ru':                                'tt_RU.TATAR-CYR',
   1692     'tt_ru.koi8c':                          'tt_RU.KOI8-C',
   1693     'tt_ru.tatarcyr':                       'tt_RU.TATAR-CYR',
   1694     'tt_ru@iqtelif':                        'tt_RU.UTF-8@iqtelif',
   1695     'turkish':                              'tr_TR.ISO8859-9',
   1696     'turkish.iso88599':                     'tr_TR.ISO8859-9',
   1697     'ug_cn':                                'ug_CN.UTF-8',
   1698     'uk':                                   'uk_UA.KOI8-U',
   1699     'uk_ua':                                'uk_UA.KOI8-U',
   1700     'uk_ua.cp1251':                         'uk_UA.CP1251',
   1701     'uk_ua.iso88595':                       'uk_UA.ISO8859-5',
   1702     'uk_ua.koi8u':                          'uk_UA.KOI8-U',
   1703     'uk_ua.microsoftcp1251':                'uk_UA.CP1251',
   1704     'univ':                                 'en_US.utf',
   1705     'universal':                            'en_US.utf',
   1706     'universal.utf8@ucs4':                  'en_US.UTF-8',
   1707     'unm_us':                               'unm_US.UTF-8',
   1708     'ur':                                   'ur_PK.CP1256',
   1709     'ur_in':                                'ur_IN.UTF-8',
   1710     'ur_pk':                                'ur_PK.CP1256',
   1711     'ur_pk.cp1256':                         'ur_PK.CP1256',
   1712     'ur_pk.microsoftcp1256':                'ur_PK.CP1256',
   1713     'uz':                                   'uz_UZ.UTF-8',
   1714     'uz_uz':                                'uz_UZ.UTF-8',
   1715     'uz_uz.iso88591':                       'uz_UZ.ISO8859-1',
   1716     'uz_uz.utf8@cyrillic':                  'uz_UZ.UTF-8',
   1717     'uz_uz@cyrillic':                       'uz_UZ.UTF-8',
   1718     've':                                   've_ZA.UTF-8',
   1719     've_za':                                've_ZA.UTF-8',
   1720     'vi':                                   'vi_VN.TCVN',
   1721     'vi_vn':                                'vi_VN.TCVN',
   1722     'vi_vn.tcvn':                           'vi_VN.TCVN',
   1723     'vi_vn.tcvn5712':                       'vi_VN.TCVN',
   1724     'vi_vn.viscii':                         'vi_VN.VISCII',
   1725     'vi_vn.viscii111':                      'vi_VN.VISCII',
   1726     'wa':                                   'wa_BE.ISO8859-1',
   1727     'wa_be':                                'wa_BE.ISO8859-1',
   1728     'wa_be.iso88591':                       'wa_BE.ISO8859-1',
   1729     'wa_be.iso885915':                      'wa_BE.ISO8859-15',
   1730     'wa_be.iso885915@euro':                 'wa_BE.ISO8859-15',
   1731     'wa_be@euro':                           'wa_BE.ISO8859-15',
   1732     'wae_ch':                               'wae_CH.UTF-8',
   1733     'wal_et':                               'wal_ET.UTF-8',
   1734     'wo_sn':                                'wo_SN.UTF-8',
   1735     'xh':                                   'xh_ZA.ISO8859-1',
   1736     'xh_za':                                'xh_ZA.ISO8859-1',
   1737     'xh_za.iso88591':                       'xh_ZA.ISO8859-1',
   1738     'yi':                                   'yi_US.CP1255',
   1739     'yi_us':                                'yi_US.CP1255',
   1740     'yi_us.cp1255':                         'yi_US.CP1255',
   1741     'yi_us.microsoftcp1255':                'yi_US.CP1255',
   1742     'yo_ng':                                'yo_NG.UTF-8',
   1743     'yue_hk':                               'yue_HK.UTF-8',
   1744     'zh':                                   'zh_CN.eucCN',
   1745     'zh_cn':                                'zh_CN.gb2312',
   1746     'zh_cn.big5':                           'zh_TW.big5',
   1747     'zh_cn.euc':                            'zh_CN.eucCN',
   1748     'zh_cn.gb18030':                        'zh_CN.gb18030',
   1749     'zh_cn.gb2312':                         'zh_CN.gb2312',
   1750     'zh_cn.gbk':                            'zh_CN.gbk',
   1751     'zh_hk':                                'zh_HK.big5hkscs',
   1752     'zh_hk.big5':                           'zh_HK.big5',
   1753     'zh_hk.big5hk':                         'zh_HK.big5hkscs',
   1754     'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',
   1755     'zh_sg':                                'zh_SG.GB2312',
   1756     'zh_sg.gbk':                            'zh_SG.GBK',
   1757     'zh_tw':                                'zh_TW.big5',
   1758     'zh_tw.big5':                           'zh_TW.big5',
   1759     'zh_tw.euc':                            'zh_TW.eucTW',
   1760     'zh_tw.euctw':                          'zh_TW.eucTW',
   1761     'zu':                                   'zu_ZA.ISO8859-1',
   1762     'zu_za':                                'zu_ZA.ISO8859-1',
   1763     'zu_za.iso88591':                       'zu_ZA.ISO8859-1',
   1764 }
   1765 
   1766 #
   1767 # This maps Windows language identifiers to locale strings.
   1768 #
   1769 # This list has been updated from
   1770 # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
   1771 # to include every locale up to Windows Vista.
   1772 #
   1773 # NOTE: this mapping is incomplete.  If your language is missing, please
   1774 # submit a bug report to the Python bug tracker at http://bugs.python.org/
   1775 # Make sure you include the missing language identifier and the suggested
   1776 # locale code.
   1777 #
   1778 
   1779 windows_locale = {
   1780     0x0436: "af_ZA", # Afrikaans
   1781     0x041c: "sq_AL", # Albanian
   1782     0x0484: "gsw_FR",# Alsatian - France
   1783     0x045e: "am_ET", # Amharic - Ethiopia
   1784     0x0401: "ar_SA", # Arabic - Saudi Arabia
   1785     0x0801: "ar_IQ", # Arabic - Iraq
   1786     0x0c01: "ar_EG", # Arabic - Egypt
   1787     0x1001: "ar_LY", # Arabic - Libya
   1788     0x1401: "ar_DZ", # Arabic - Algeria
   1789     0x1801: "ar_MA", # Arabic - Morocco
   1790     0x1c01: "ar_TN", # Arabic - Tunisia
   1791     0x2001: "ar_OM", # Arabic - Oman
   1792     0x2401: "ar_YE", # Arabic - Yemen
   1793     0x2801: "ar_SY", # Arabic - Syria
   1794     0x2c01: "ar_JO", # Arabic - Jordan
   1795     0x3001: "ar_LB", # Arabic - Lebanon
   1796     0x3401: "ar_KW", # Arabic - Kuwait
   1797     0x3801: "ar_AE", # Arabic - United Arab Emirates
   1798     0x3c01: "ar_BH", # Arabic - Bahrain
   1799     0x4001: "ar_QA", # Arabic - Qatar
   1800     0x042b: "hy_AM", # Armenian
   1801     0x044d: "as_IN", # Assamese - India
   1802     0x042c: "az_AZ", # Azeri - Latin
   1803     0x082c: "az_AZ", # Azeri - Cyrillic
   1804     0x046d: "ba_RU", # Bashkir
   1805     0x042d: "eu_ES", # Basque - Russia
   1806     0x0423: "be_BY", # Belarusian
   1807     0x0445: "bn_IN", # Begali
   1808     0x201a: "bs_BA", # Bosnian - Cyrillic
   1809     0x141a: "bs_BA", # Bosnian - Latin
   1810     0x047e: "br_FR", # Breton - France
   1811     0x0402: "bg_BG", # Bulgarian
   1812 #    0x0455: "my_MM", # Burmese - Not supported
   1813     0x0403: "ca_ES", # Catalan
   1814     0x0004: "zh_CHS",# Chinese - Simplified
   1815     0x0404: "zh_TW", # Chinese - Taiwan
   1816     0x0804: "zh_CN", # Chinese - PRC
   1817     0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
   1818     0x1004: "zh_SG", # Chinese - Singapore
   1819     0x1404: "zh_MO", # Chinese - Macao S.A.R.
   1820     0x7c04: "zh_CHT",# Chinese - Traditional
   1821     0x0483: "co_FR", # Corsican - France
   1822     0x041a: "hr_HR", # Croatian
   1823     0x101a: "hr_BA", # Croatian - Bosnia
   1824     0x0405: "cs_CZ", # Czech
   1825     0x0406: "da_DK", # Danish
   1826     0x048c: "gbz_AF",# Dari - Afghanistan
   1827     0x0465: "div_MV",# Divehi - Maldives
   1828     0x0413: "nl_NL", # Dutch - The Netherlands
   1829     0x0813: "nl_BE", # Dutch - Belgium
   1830     0x0409: "en_US", # English - United States
   1831     0x0809: "en_GB", # English - United Kingdom
   1832     0x0c09: "en_AU", # English - Australia
   1833     0x1009: "en_CA", # English - Canada
   1834     0x1409: "en_NZ", # English - New Zealand
   1835     0x1809: "en_IE", # English - Ireland
   1836     0x1c09: "en_ZA", # English - South Africa
   1837     0x2009: "en_JA", # English - Jamaica
   1838     0x2409: "en_CB", # English - Caribbean
   1839     0x2809: "en_BZ", # English - Belize
   1840     0x2c09: "en_TT", # English - Trinidad
   1841     0x3009: "en_ZW", # English - Zimbabwe
   1842     0x3409: "en_PH", # English - Philippines
   1843     0x4009: "en_IN", # English - India
   1844     0x4409: "en_MY", # English - Malaysia
   1845     0x4809: "en_IN", # English - Singapore
   1846     0x0425: "et_EE", # Estonian
   1847     0x0438: "fo_FO", # Faroese
   1848     0x0464: "fil_PH",# Filipino
   1849     0x040b: "fi_FI", # Finnish
   1850     0x040c: "fr_FR", # French - France
   1851     0x080c: "fr_BE", # French - Belgium
   1852     0x0c0c: "fr_CA", # French - Canada
   1853     0x100c: "fr_CH", # French - Switzerland
   1854     0x140c: "fr_LU", # French - Luxembourg
   1855     0x180c: "fr_MC", # French - Monaco
   1856     0x0462: "fy_NL", # Frisian - Netherlands
   1857     0x0456: "gl_ES", # Galician
   1858     0x0437: "ka_GE", # Georgian
   1859     0x0407: "de_DE", # German - Germany
   1860     0x0807: "de_CH", # German - Switzerland
   1861     0x0c07: "de_AT", # German - Austria
   1862     0x1007: "de_LU", # German - Luxembourg
   1863     0x1407: "de_LI", # German - Liechtenstein
   1864     0x0408: "el_GR", # Greek
   1865     0x046f: "kl_GL", # Greenlandic - Greenland
   1866     0x0447: "gu_IN", # Gujarati
   1867     0x0468: "ha_NG", # Hausa - Latin
   1868     0x040d: "he_IL", # Hebrew
   1869     0x0439: "hi_IN", # Hindi
   1870     0x040e: "hu_HU", # Hungarian
   1871     0x040f: "is_IS", # Icelandic
   1872     0x0421: "id_ID", # Indonesian
   1873     0x045d: "iu_CA", # Inuktitut - Syllabics
   1874     0x085d: "iu_CA", # Inuktitut - Latin
   1875     0x083c: "ga_IE", # Irish - Ireland
   1876     0x0410: "it_IT", # Italian - Italy
   1877     0x0810: "it_CH", # Italian - Switzerland
   1878     0x0411: "ja_JP", # Japanese
   1879     0x044b: "kn_IN", # Kannada - India
   1880     0x043f: "kk_KZ", # Kazakh
   1881     0x0453: "kh_KH", # Khmer - Cambodia
   1882     0x0486: "qut_GT",# K'iche - Guatemala
   1883     0x0487: "rw_RW", # Kinyarwanda - Rwanda
   1884     0x0457: "kok_IN",# Konkani
   1885     0x0412: "ko_KR", # Korean
   1886     0x0440: "ky_KG", # Kyrgyz
   1887     0x0454: "lo_LA", # Lao - Lao PDR
   1888     0x0426: "lv_LV", # Latvian
   1889     0x0427: "lt_LT", # Lithuanian
   1890     0x082e: "dsb_DE",# Lower Sorbian - Germany
   1891     0x046e: "lb_LU", # Luxembourgish
   1892     0x042f: "mk_MK", # FYROM Macedonian
   1893     0x043e: "ms_MY", # Malay - Malaysia
   1894     0x083e: "ms_BN", # Malay - Brunei Darussalam
   1895     0x044c: "ml_IN", # Malayalam - India
   1896     0x043a: "mt_MT", # Maltese
   1897     0x0481: "mi_NZ", # Maori
   1898     0x047a: "arn_CL",# Mapudungun
   1899     0x044e: "mr_IN", # Marathi
   1900     0x047c: "moh_CA",# Mohawk - Canada
   1901     0x0450: "mn_MN", # Mongolian - Cyrillic
   1902     0x0850: "mn_CN", # Mongolian - PRC
   1903     0x0461: "ne_NP", # Nepali
   1904     0x0414: "nb_NO", # Norwegian - Bokmal
   1905     0x0814: "nn_NO", # Norwegian - Nynorsk
   1906     0x0482: "oc_FR", # Occitan - France
   1907     0x0448: "or_IN", # Oriya - India
   1908     0x0463: "ps_AF", # Pashto - Afghanistan
   1909     0x0429: "fa_IR", # Persian
   1910     0x0415: "pl_PL", # Polish
   1911     0x0416: "pt_BR", # Portuguese - Brazil
   1912     0x0816: "pt_PT", # Portuguese - Portugal
   1913     0x0446: "pa_IN", # Punjabi
   1914     0x046b: "quz_BO",# Quechua (Bolivia)
   1915     0x086b: "quz_EC",# Quechua (Ecuador)
   1916     0x0c6b: "quz_PE",# Quechua (Peru)
   1917     0x0418: "ro_RO", # Romanian - Romania
   1918     0x0417: "rm_CH", # Romansh
   1919     0x0419: "ru_RU", # Russian
   1920     0x243b: "smn_FI",# Sami Finland
   1921     0x103b: "smj_NO",# Sami Norway
   1922     0x143b: "smj_SE",# Sami Sweden
   1923     0x043b: "se_NO", # Sami Northern Norway
   1924     0x083b: "se_SE", # Sami Northern Sweden
   1925     0x0c3b: "se_FI", # Sami Northern Finland
   1926     0x203b: "sms_FI",# Sami Skolt
   1927     0x183b: "sma_NO",# Sami Southern Norway
   1928     0x1c3b: "sma_SE",# Sami Southern Sweden
   1929     0x044f: "sa_IN", # Sanskrit
   1930     0x0c1a: "sr_SP", # Serbian - Cyrillic
   1931     0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
   1932     0x081a: "sr_SP", # Serbian - Latin
   1933     0x181a: "sr_BA", # Serbian - Bosnia Latin
   1934     0x045b: "si_LK", # Sinhala - Sri Lanka
   1935     0x046c: "ns_ZA", # Northern Sotho
   1936     0x0432: "tn_ZA", # Setswana - Southern Africa
   1937     0x041b: "sk_SK", # Slovak
   1938     0x0424: "sl_SI", # Slovenian
   1939     0x040a: "es_ES", # Spanish - Spain
   1940     0x080a: "es_MX", # Spanish - Mexico
   1941     0x0c0a: "es_ES", # Spanish - Spain (Modern)
   1942     0x100a: "es_GT", # Spanish - Guatemala
   1943     0x140a: "es_CR", # Spanish - Costa Rica
   1944     0x180a: "es_PA", # Spanish - Panama
   1945     0x1c0a: "es_DO", # Spanish - Dominican Republic
   1946     0x200a: "es_VE", # Spanish - Venezuela
   1947     0x240a: "es_CO", # Spanish - Colombia
   1948     0x280a: "es_PE", # Spanish - Peru
   1949     0x2c0a: "es_AR", # Spanish - Argentina
   1950     0x300a: "es_EC", # Spanish - Ecuador
   1951     0x340a: "es_CL", # Spanish - Chile
   1952     0x380a: "es_UR", # Spanish - Uruguay
   1953     0x3c0a: "es_PY", # Spanish - Paraguay
   1954     0x400a: "es_BO", # Spanish - Bolivia
   1955     0x440a: "es_SV", # Spanish - El Salvador
   1956     0x480a: "es_HN", # Spanish - Honduras
   1957     0x4c0a: "es_NI", # Spanish - Nicaragua
   1958     0x500a: "es_PR", # Spanish - Puerto Rico
   1959     0x540a: "es_US", # Spanish - United States
   1960 #    0x0430: "", # Sutu - Not supported
   1961     0x0441: "sw_KE", # Swahili
   1962     0x041d: "sv_SE", # Swedish - Sweden
   1963     0x081d: "sv_FI", # Swedish - Finland
   1964     0x045a: "syr_SY",# Syriac
   1965     0x0428: "tg_TJ", # Tajik - Cyrillic
   1966     0x085f: "tmz_DZ",# Tamazight - Latin
   1967     0x0449: "ta_IN", # Tamil
   1968     0x0444: "tt_RU", # Tatar
   1969     0x044a: "te_IN", # Telugu
   1970     0x041e: "th_TH", # Thai
   1971     0x0851: "bo_BT", # Tibetan - Bhutan
   1972     0x0451: "bo_CN", # Tibetan - PRC
   1973     0x041f: "tr_TR", # Turkish
   1974     0x0442: "tk_TM", # Turkmen - Cyrillic
   1975     0x0480: "ug_CN", # Uighur - Arabic
   1976     0x0422: "uk_UA", # Ukrainian
   1977     0x042e: "wen_DE",# Upper Sorbian - Germany
   1978     0x0420: "ur_PK", # Urdu
   1979     0x0820: "ur_IN", # Urdu - India
   1980     0x0443: "uz_UZ", # Uzbek - Latin
   1981     0x0843: "uz_UZ", # Uzbek - Cyrillic
   1982     0x042a: "vi_VN", # Vietnamese
   1983     0x0452: "cy_GB", # Welsh
   1984     0x0488: "wo_SN", # Wolof - Senegal
   1985     0x0434: "xh_ZA", # Xhosa - South Africa
   1986     0x0485: "sah_RU",# Yakut - Cyrillic
   1987     0x0478: "ii_CN", # Yi - PRC
   1988     0x046a: "yo_NG", # Yoruba - Nigeria
   1989     0x0435: "zu_ZA", # Zulu
   1990 }
   1991 
   1992 def _print_locale():
   1993 
   1994     """ Test function.
   1995     """
   1996     categories = {}
   1997     def _init_categories(categories=categories):
   1998         for k,v in globals().items():
   1999             if k[:3] == 'LC_':
   2000                 categories[k] = v
   2001     _init_categories()
   2002     del categories['LC_ALL']
   2003 
   2004     print 'Locale defaults as determined by getdefaultlocale():'
   2005     print '-'*72
   2006     lang, enc = getdefaultlocale()
   2007     print 'Language: ', lang or '(undefined)'
   2008     print 'Encoding: ', enc or '(undefined)'
   2009     print
   2010 
   2011     print 'Locale settings on startup:'
   2012     print '-'*72
   2013     for name,category in categories.items():
   2014         print name, '...'
   2015         lang, enc = getlocale(category)
   2016         print '   Language: ', lang or '(undefined)'
   2017         print '   Encoding: ', enc or '(undefined)'
   2018         print
   2019 
   2020     print
   2021     print 'Locale settings after calling resetlocale():'
   2022     print '-'*72
   2023     resetlocale()
   2024     for name,category in categories.items():
   2025         print name, '...'
   2026         lang, enc = getlocale(category)
   2027         print '   Language: ', lang or '(undefined)'
   2028         print '   Encoding: ', enc or '(undefined)'
   2029         print
   2030 
   2031     try:
   2032         setlocale(LC_ALL, "")
   2033     except:
   2034         print 'NOTE:'
   2035         print 'setlocale(LC_ALL, "") does not support the default locale'
   2036         print 'given in the OS environment variables.'
   2037     else:
   2038         print
   2039         print 'Locale settings after calling setlocale(LC_ALL, ""):'
   2040         print '-'*72
   2041         for name,category in categories.items():
   2042             print name, '...'
   2043             lang, enc = getlocale(category)
   2044             print '   Language: ', lang or '(undefined)'
   2045             print '   Encoding: ', enc or '(undefined)'
   2046             print
   2047 
   2048 ###
   2049 
   2050 try:
   2051     LC_MESSAGES
   2052 except NameError:
   2053     pass
   2054 else:
   2055     __all__.append("LC_MESSAGES")
   2056 
   2057 if __name__=='__main__':
   2058     print 'Locale aliasing:'
   2059     print
   2060     _print_locale()
   2061     print
   2062     print 'Number formatting:'
   2063     print
   2064     _test()
   2065