]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 4/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Lib / locale.py
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py
new file mode 100644 (file)
index 0000000..7d466bf
--- /dev/null
@@ -0,0 +1,2062 @@
+""" Locale support.\r
+\r
+    The module provides low-level access to the C lib's locale APIs\r
+    and adds high level number formatting APIs as well as a locale\r
+    aliasing engine to complement these.\r
+\r
+    The aliasing engine includes support for many commonly used locale\r
+    names and maps them to values suitable for passing to the C lib's\r
+    setlocale() function. It also includes default encodings for all\r
+    supported locale names.\r
+\r
+"""\r
+\r
+import sys\r
+import encodings\r
+import encodings.aliases\r
+import re\r
+import operator\r
+import functools\r
+\r
+try:\r
+    _unicode = unicode\r
+except NameError:\r
+    # If Python is built without Unicode support, the unicode type\r
+    # will not exist. Fake one.\r
+    class _unicode(object):\r
+        pass\r
+\r
+# Try importing the _locale module.\r
+#\r
+# If this fails, fall back on a basic 'C' locale emulation.\r
+\r
+# Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before\r
+# trying the import.  So __all__ is also fiddled at the end of the file.\r
+__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",\r
+           "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",\r
+           "str", "atof", "atoi", "format", "format_string", "currency",\r
+           "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",\r
+           "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]\r
+\r
+try:\r
+\r
+    from _locale import *\r
+\r
+except ImportError:\r
+\r
+    # Locale emulation\r
+\r
+    CHAR_MAX = 127\r
+    LC_ALL = 6\r
+    LC_COLLATE = 3\r
+    LC_CTYPE = 0\r
+    LC_MESSAGES = 5\r
+    LC_MONETARY = 4\r
+    LC_NUMERIC = 1\r
+    LC_TIME = 2\r
+    Error = ValueError\r
+\r
+    def localeconv():\r
+        """ localeconv() -> dict.\r
+            Returns numeric and monetary locale-specific parameters.\r
+        """\r
+        # 'C' locale default values\r
+        return {'grouping': [127],\r
+                'currency_symbol': '',\r
+                'n_sign_posn': 127,\r
+                'p_cs_precedes': 127,\r
+                'n_cs_precedes': 127,\r
+                'mon_grouping': [],\r
+                'n_sep_by_space': 127,\r
+                'decimal_point': '.',\r
+                'negative_sign': '',\r
+                'positive_sign': '',\r
+                'p_sep_by_space': 127,\r
+                'int_curr_symbol': '',\r
+                'p_sign_posn': 127,\r
+                'thousands_sep': '',\r
+                'mon_thousands_sep': '',\r
+                'frac_digits': 127,\r
+                'mon_decimal_point': '',\r
+                'int_frac_digits': 127}\r
+\r
+    def setlocale(category, value=None):\r
+        """ setlocale(integer,string=None) -> string.\r
+            Activates/queries locale processing.\r
+        """\r
+        if value not in (None, '', 'C'):\r
+            raise Error, '_locale emulation only supports "C" locale'\r
+        return 'C'\r
+\r
+    def strcoll(a,b):\r
+        """ strcoll(string,string) -> int.\r
+            Compares two strings according to the locale.\r
+        """\r
+        return cmp(a,b)\r
+\r
+    def strxfrm(s):\r
+        """ strxfrm(string) -> string.\r
+            Returns a string that behaves for cmp locale-aware.\r
+        """\r
+        return s\r
+\r
+\r
+_localeconv = localeconv\r
+\r
+# With this dict, you can override some items of localeconv's return value.\r
+# This is useful for testing purposes.\r
+_override_localeconv = {}\r
+\r
+@functools.wraps(_localeconv)\r
+def localeconv():\r
+    d = _localeconv()\r
+    if _override_localeconv:\r
+        d.update(_override_localeconv)\r
+    return d\r
+\r
+\r
+### Number formatting APIs\r
+\r
+# Author: Martin von Loewis\r
+# improved by Georg Brandl\r
+\r
+# Iterate over grouping intervals\r
+def _grouping_intervals(grouping):\r
+    last_interval = None\r
+    for interval in grouping:\r
+        # if grouping is -1, we are done\r
+        if interval == CHAR_MAX:\r
+            return\r
+        # 0: re-use last group ad infinitum\r
+        if interval == 0:\r
+            if last_interval is None:\r
+                raise ValueError("invalid grouping")\r
+            while True:\r
+                yield last_interval\r
+        yield interval\r
+        last_interval = interval\r
+\r
+#perform the grouping from right to left\r
+def _group(s, monetary=False):\r
+    conv = localeconv()\r
+    thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']\r
+    grouping = conv[monetary and 'mon_grouping' or 'grouping']\r
+    if not grouping:\r
+        return (s, 0)\r
+    if s[-1] == ' ':\r
+        stripped = s.rstrip()\r
+        right_spaces = s[len(stripped):]\r
+        s = stripped\r
+    else:\r
+        right_spaces = ''\r
+    left_spaces = ''\r
+    groups = []\r
+    for interval in _grouping_intervals(grouping):\r
+        if not s or s[-1] not in "0123456789":\r
+            # only non-digit characters remain (sign, spaces)\r
+            left_spaces = s\r
+            s = ''\r
+            break\r
+        groups.append(s[-interval:])\r
+        s = s[:-interval]\r
+    if s:\r
+        groups.append(s)\r
+    groups.reverse()\r
+    return (\r
+        left_spaces + thousands_sep.join(groups) + right_spaces,\r
+        len(thousands_sep) * (len(groups) - 1)\r
+    )\r
+\r
+# Strip a given amount of excess padding from the given string\r
+def _strip_padding(s, amount):\r
+    lpos = 0\r
+    while amount and s[lpos] == ' ':\r
+        lpos += 1\r
+        amount -= 1\r
+    rpos = len(s) - 1\r
+    while amount and s[rpos] == ' ':\r
+        rpos -= 1\r
+        amount -= 1\r
+    return s[lpos:rpos+1]\r
+\r
+_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'\r
+                         r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')\r
+\r
+def format(percent, value, grouping=False, monetary=False, *additional):\r
+    """Returns the locale-aware substitution of a %? specifier\r
+    (percent).\r
+\r
+    additional is for format strings which contain one or more\r
+    '*' modifiers."""\r
+    # this is only for one-percent-specifier strings and this should be checked\r
+    match = _percent_re.match(percent)\r
+    if not match or len(match.group())!= len(percent):\r
+        raise ValueError(("format() must be given exactly one %%char "\r
+                         "format specifier, %s not valid") % repr(percent))\r
+    return _format(percent, value, grouping, monetary, *additional)\r
+\r
+def _format(percent, value, grouping=False, monetary=False, *additional):\r
+    if additional:\r
+        formatted = percent % ((value,) + additional)\r
+    else:\r
+        formatted = percent % value\r
+    # floats and decimal ints need special action!\r
+    if percent[-1] in 'eEfFgG':\r
+        seps = 0\r
+        parts = formatted.split('.')\r
+        if grouping:\r
+            parts[0], seps = _group(parts[0], monetary=monetary)\r
+        decimal_point = localeconv()[monetary and 'mon_decimal_point'\r
+                                              or 'decimal_point']\r
+        formatted = decimal_point.join(parts)\r
+        if seps:\r
+            formatted = _strip_padding(formatted, seps)\r
+    elif percent[-1] in 'diu':\r
+        seps = 0\r
+        if grouping:\r
+            formatted, seps = _group(formatted, monetary=monetary)\r
+        if seps:\r
+            formatted = _strip_padding(formatted, seps)\r
+    return formatted\r
+\r
+def format_string(f, val, grouping=False):\r
+    """Formats a string in the same way that the % formatting would use,\r
+    but takes the current locale into account.\r
+    Grouping is applied if the third parameter is true."""\r
+    percents = list(_percent_re.finditer(f))\r
+    new_f = _percent_re.sub('%s', f)\r
+\r
+    if operator.isMappingType(val):\r
+        new_val = []\r
+        for perc in percents:\r
+            if perc.group()[-1]=='%':\r
+                new_val.append('%')\r
+            else:\r
+                new_val.append(format(perc.group(), val, grouping))\r
+    else:\r
+        if not isinstance(val, tuple):\r
+            val = (val,)\r
+        new_val = []\r
+        i = 0\r
+        for perc in percents:\r
+            if perc.group()[-1]=='%':\r
+                new_val.append('%')\r
+            else:\r
+                starcount = perc.group('modifiers').count('*')\r
+                new_val.append(_format(perc.group(),\r
+                                      val[i],\r
+                                      grouping,\r
+                                      False,\r
+                                      *val[i+1:i+1+starcount]))\r
+                i += (1 + starcount)\r
+    val = tuple(new_val)\r
+\r
+    return new_f % val\r
+\r
+def currency(val, symbol=True, grouping=False, international=False):\r
+    """Formats val according to the currency settings\r
+    in the current locale."""\r
+    conv = localeconv()\r
+\r
+    # check for illegal values\r
+    digits = conv[international and 'int_frac_digits' or 'frac_digits']\r
+    if digits == 127:\r
+        raise ValueError("Currency formatting is not possible using "\r
+                         "the 'C' locale.")\r
+\r
+    s = format('%%.%if' % digits, abs(val), grouping, monetary=True)\r
+    # '<' and '>' are markers if the sign must be inserted between symbol and value\r
+    s = '<' + s + '>'\r
+\r
+    if symbol:\r
+        smb = conv[international and 'int_curr_symbol' or 'currency_symbol']\r
+        precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']\r
+        separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']\r
+\r
+        if precedes:\r
+            s = smb + (separated and ' ' or '') + s\r
+        else:\r
+            s = s + (separated and ' ' or '') + smb\r
+\r
+    sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']\r
+    sign = conv[val<0 and 'negative_sign' or 'positive_sign']\r
+\r
+    if sign_pos == 0:\r
+        s = '(' + s + ')'\r
+    elif sign_pos == 1:\r
+        s = sign + s\r
+    elif sign_pos == 2:\r
+        s = s + sign\r
+    elif sign_pos == 3:\r
+        s = s.replace('<', sign)\r
+    elif sign_pos == 4:\r
+        s = s.replace('>', sign)\r
+    else:\r
+        # the default if nothing specified;\r
+        # this should be the most fitting sign position\r
+        s = sign + s\r
+\r
+    return s.replace('<', '').replace('>', '')\r
+\r
+def str(val):\r
+    """Convert float to integer, taking the locale into account."""\r
+    return format("%.12g", val)\r
+\r
+def atof(string, func=float):\r
+    "Parses a string as a float according to the locale settings."\r
+    #First, get rid of the grouping\r
+    ts = localeconv()['thousands_sep']\r
+    if ts:\r
+        string = string.replace(ts, '')\r
+    #next, replace the decimal point with a dot\r
+    dd = localeconv()['decimal_point']\r
+    if dd:\r
+        string = string.replace(dd, '.')\r
+    #finally, parse the string\r
+    return func(string)\r
+\r
+def atoi(str):\r
+    "Converts a string to an integer according to the locale settings."\r
+    return atof(str, int)\r
+\r
+def _test():\r
+    setlocale(LC_ALL, "")\r
+    #do grouping\r
+    s1 = format("%d", 123456789,1)\r
+    print s1, "is", atoi(s1)\r
+    #standard formatting\r
+    s1 = str(3.14)\r
+    print s1, "is", atof(s1)\r
+\r
+### Locale name aliasing engine\r
+\r
+# Author: Marc-Andre Lemburg, mal@lemburg.com\r
+# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>\r
+\r
+# store away the low-level version of setlocale (it's\r
+# overridden below)\r
+_setlocale = setlocale\r
+\r
+# Avoid relying on the locale-dependent .lower() method\r
+# (see issue #1813).\r
+_ascii_lower_map = ''.join(\r
+    chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)\r
+    for x in range(256)\r
+)\r
+\r
+def _replace_encoding(code, encoding):\r
+    if '.' in code:\r
+        langname = code[:code.index('.')]\r
+    else:\r
+        langname = code\r
+    # Convert the encoding to a C lib compatible encoding string\r
+    norm_encoding = encodings.normalize_encoding(encoding)\r
+    #print('norm encoding: %r' % norm_encoding)\r
+    norm_encoding = encodings.aliases.aliases.get(norm_encoding,\r
+                                                  norm_encoding)\r
+    #print('aliased encoding: %r' % norm_encoding)\r
+    encoding = locale_encoding_alias.get(norm_encoding,\r
+                                         norm_encoding)\r
+    #print('found encoding %r' % encoding)\r
+    return langname + '.' + encoding\r
+\r
+def normalize(localename):\r
+\r
+    """ Returns a normalized locale code for the given locale\r
+        name.\r
+\r
+        The returned locale code is formatted for use with\r
+        setlocale().\r
+\r
+        If normalization fails, the original name is returned\r
+        unchanged.\r
+\r
+        If the given encoding is not known, the function defaults to\r
+        the default encoding for the locale code just like setlocale()\r
+        does.\r
+\r
+    """\r
+    # Normalize the locale name and extract the encoding and modifier\r
+    if isinstance(localename, _unicode):\r
+        localename = localename.encode('ascii')\r
+    code = localename.translate(_ascii_lower_map)\r
+    if ':' in code:\r
+        # ':' is sometimes used as encoding delimiter.\r
+        code = code.replace(':', '.')\r
+    if '@' in code:\r
+        code, modifier = code.split('@', 1)\r
+    else:\r
+        modifier = ''\r
+    if '.' in code:\r
+        langname, encoding = code.split('.')[:2]\r
+    else:\r
+        langname = code\r
+        encoding = ''\r
+\r
+    # First lookup: fullname (possibly with encoding and modifier)\r
+    lang_enc = langname\r
+    if encoding:\r
+        norm_encoding = encoding.replace('-', '')\r
+        norm_encoding = norm_encoding.replace('_', '')\r
+        lang_enc += '.' + norm_encoding\r
+    lookup_name = lang_enc\r
+    if modifier:\r
+        lookup_name += '@' + modifier\r
+    code = locale_alias.get(lookup_name, None)\r
+    if code is not None:\r
+        return code\r
+    #print('first lookup failed')\r
+\r
+    if modifier:\r
+        # Second try: fullname without modifier (possibly with encoding)\r
+        code = locale_alias.get(lang_enc, None)\r
+        if code is not None:\r
+            #print('lookup without modifier succeeded')\r
+            if '@' not in code:\r
+                return code + '@' + modifier\r
+            if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:\r
+                return code\r
+        #print('second lookup failed')\r
+\r
+    if encoding:\r
+        # Third try: langname (without encoding, possibly with modifier)\r
+        lookup_name = langname\r
+        if modifier:\r
+            lookup_name += '@' + modifier\r
+        code = locale_alias.get(lookup_name, None)\r
+        if code is not None:\r
+            #print('lookup without encoding succeeded')\r
+            if '@' not in code:\r
+                return _replace_encoding(code, encoding)\r
+            code, modifier = code.split('@', 1)\r
+            return _replace_encoding(code, encoding) + '@' + modifier\r
+\r
+        if modifier:\r
+            # Fourth try: langname (without encoding and modifier)\r
+            code = locale_alias.get(langname, None)\r
+            if code is not None:\r
+                #print('lookup without modifier and encoding succeeded')\r
+                if '@' not in code:\r
+                    return _replace_encoding(code, encoding) + '@' + modifier\r
+                code, defmod = code.split('@', 1)\r
+                if defmod.translate(_ascii_lower_map) == modifier:\r
+                    return _replace_encoding(code, encoding) + '@' + defmod\r
+\r
+    return localename\r
+\r
+def _parse_localename(localename):\r
+\r
+    """ Parses the locale code for localename and returns the\r
+        result as tuple (language code, encoding).\r
+\r
+        The localename is normalized and passed through the locale\r
+        alias engine. A ValueError is raised in case the locale name\r
+        cannot be parsed.\r
+\r
+        The language code corresponds to RFC 1766.  code and encoding\r
+        can be None in case the values cannot be determined or are\r
+        unknown to this implementation.\r
+\r
+    """\r
+    code = normalize(localename)\r
+    if '@' in code:\r
+        # Deal with locale modifiers\r
+        code, modifier = code.split('@', 1)\r
+        if modifier == 'euro' and '.' not in code:\r
+            # Assume Latin-9 for @euro locales. This is bogus,\r
+            # since some systems may use other encodings for these\r
+            # locales. Also, we ignore other modifiers.\r
+            return code, 'iso-8859-15'\r
+\r
+    if '.' in code:\r
+        return tuple(code.split('.')[:2])\r
+    elif code == 'C':\r
+        return None, None\r
+    raise ValueError, 'unknown locale: %s' % localename\r
+\r
+def _build_localename(localetuple):\r
+\r
+    """ Builds a locale code from the given tuple (language code,\r
+        encoding).\r
+\r
+        No aliasing or normalizing takes place.\r
+\r
+    """\r
+    language, encoding = localetuple\r
+    if language is None:\r
+        language = 'C'\r
+    if encoding is None:\r
+        return language\r
+    else:\r
+        return language + '.' + encoding\r
+\r
+def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):\r
+\r
+    """ Tries to determine the default locale settings and returns\r
+        them as tuple (language code, encoding).\r
+\r
+        According to POSIX, a program which has not called\r
+        setlocale(LC_ALL, "") runs using the portable 'C' locale.\r
+        Calling setlocale(LC_ALL, "") lets it use the default locale as\r
+        defined by the LANG variable. Since we don't want to interfere\r
+        with the current locale setting we thus emulate the behavior\r
+        in the way described above.\r
+\r
+        To maintain compatibility with other platforms, not only the\r
+        LANG variable is tested, but a list of variables given as\r
+        envvars parameter. The first found to be defined will be\r
+        used. envvars defaults to the search path used in GNU gettext;\r
+        it must always contain the variable name 'LANG'.\r
+\r
+        Except for the code 'C', the language code corresponds to RFC\r
+        1766.  code and encoding can be None in case the values cannot\r
+        be determined.\r
+\r
+    """\r
+\r
+    try:\r
+        # check if it's supported by the _locale module\r
+        import _locale\r
+        code, encoding = _locale._getdefaultlocale()\r
+    except (ImportError, AttributeError):\r
+        pass\r
+    else:\r
+        # make sure the code/encoding values are valid\r
+        if sys.platform == "win32" and code and code[:2] == "0x":\r
+            # map windows language identifier to language name\r
+            code = windows_locale.get(int(code, 0))\r
+        # ...add other platform-specific processing here, if\r
+        # necessary...\r
+        return code, encoding\r
+\r
+    # fall back on POSIX behaviour\r
+    import os\r
+    lookup = os.environ.get\r
+    for variable in envvars:\r
+        localename = lookup(variable,None)\r
+        if localename:\r
+            if variable == 'LANGUAGE':\r
+                localename = localename.split(':')[0]\r
+            break\r
+    else:\r
+        localename = 'C'\r
+    return _parse_localename(localename)\r
+\r
+\r
+def getlocale(category=LC_CTYPE):\r
+\r
+    """ Returns the current setting for the given locale category as\r
+        tuple (language code, encoding).\r
+\r
+        category may be one of the LC_* value except LC_ALL. It\r
+        defaults to LC_CTYPE.\r
+\r
+        Except for the code 'C', the language code corresponds to RFC\r
+        1766.  code and encoding can be None in case the values cannot\r
+        be determined.\r
+\r
+    """\r
+    localename = _setlocale(category)\r
+    if category == LC_ALL and ';' in localename:\r
+        raise TypeError, 'category LC_ALL is not supported'\r
+    return _parse_localename(localename)\r
+\r
+def setlocale(category, locale=None):\r
+\r
+    """ Set the locale for the given category.  The locale can be\r
+        a string, an iterable of two strings (language code and encoding),\r
+        or None.\r
+\r
+        Iterables are converted to strings using the locale aliasing\r
+        engine.  Locale strings are passed directly to the C lib.\r
+\r
+        category may be given as one of the LC_* values.\r
+\r
+    """\r
+    if locale and type(locale) is not type(""):\r
+        # convert to string\r
+        locale = normalize(_build_localename(locale))\r
+    return _setlocale(category, locale)\r
+\r
+def resetlocale(category=LC_ALL):\r
+\r
+    """ Sets the locale for category to the default setting.\r
+\r
+        The default setting is determined by calling\r
+        getdefaultlocale(). category defaults to LC_ALL.\r
+\r
+    """\r
+    _setlocale(category, _build_localename(getdefaultlocale()))\r
+\r
+if sys.platform.startswith("win"):\r
+    # On Win32, this will return the ANSI code page\r
+    def getpreferredencoding(do_setlocale = True):\r
+        """Return the charset that the user is likely using."""\r
+        import _locale\r
+        return _locale._getdefaultlocale()[1]\r
+else:\r
+    # On Unix, if CODESET is available, use that.\r
+    try:\r
+        CODESET\r
+    except NameError:\r
+        # Fall back to parsing environment variables :-(\r
+        def getpreferredencoding(do_setlocale = True):\r
+            """Return the charset that the user is likely using,\r
+            by looking at environment variables."""\r
+            return getdefaultlocale()[1]\r
+    else:\r
+        def getpreferredencoding(do_setlocale = True):\r
+            """Return the charset that the user is likely using,\r
+            according to the system configuration."""\r
+            if do_setlocale:\r
+                oldloc = setlocale(LC_CTYPE)\r
+                try:\r
+                    setlocale(LC_CTYPE, "")\r
+                except Error:\r
+                    pass\r
+                result = nl_langinfo(CODESET)\r
+                setlocale(LC_CTYPE, oldloc)\r
+                return result\r
+            else:\r
+                return nl_langinfo(CODESET)\r
+\r
+\r
+### Database\r
+#\r
+# The following data was extracted from the locale.alias file which\r
+# comes with X11 and then hand edited removing the explicit encoding\r
+# definitions and adding some more aliases. The file is usually\r
+# available as /usr/lib/X11/locale/locale.alias.\r
+#\r
+\r
+#\r
+# The local_encoding_alias table maps lowercase encoding alias names\r
+# to C locale encoding names (case-sensitive). Note that normalize()\r
+# first looks up the encoding in the encodings.aliases dictionary and\r
+# then applies this mapping to find the correct C lib name for the\r
+# encoding.\r
+#\r
+locale_encoding_alias = {\r
+\r
+    # Mappings for non-standard encoding names used in locale names\r
+    '437':                          'C',\r
+    'c':                            'C',\r
+    'en':                           'ISO8859-1',\r
+    'jis':                          'JIS7',\r
+    'jis7':                         'JIS7',\r
+    'ajec':                         'eucJP',\r
+\r
+    # Mappings from Python codec names to C lib encoding names\r
+    'ascii':                        'ISO8859-1',\r
+    'latin_1':                      'ISO8859-1',\r
+    'iso8859_1':                    'ISO8859-1',\r
+    'iso8859_10':                   'ISO8859-10',\r
+    'iso8859_11':                   'ISO8859-11',\r
+    'iso8859_13':                   'ISO8859-13',\r
+    'iso8859_14':                   'ISO8859-14',\r
+    'iso8859_15':                   'ISO8859-15',\r
+    'iso8859_16':                   'ISO8859-16',\r
+    'iso8859_2':                    'ISO8859-2',\r
+    'iso8859_3':                    'ISO8859-3',\r
+    'iso8859_4':                    'ISO8859-4',\r
+    'iso8859_5':                    'ISO8859-5',\r
+    'iso8859_6':                    'ISO8859-6',\r
+    'iso8859_7':                    'ISO8859-7',\r
+    'iso8859_8':                    'ISO8859-8',\r
+    'iso8859_9':                    'ISO8859-9',\r
+    'iso2022_jp':                   'JIS7',\r
+    'shift_jis':                    'SJIS',\r
+    'tactis':                       'TACTIS',\r
+    'euc_jp':                       'eucJP',\r
+    'euc_kr':                       'eucKR',\r
+    'utf_8':                        'UTF-8',\r
+    'koi8_r':                       'KOI8-R',\r
+    'koi8_u':                       'KOI8-U',\r
+    # XXX This list is still incomplete. If you know more\r
+    # mappings, please file a bug report. Thanks.\r
+}\r
+\r
+#\r
+# The locale_alias table maps lowercase alias names to C locale names\r
+# (case-sensitive). Encodings are always separated from the locale\r
+# name using a dot ('.'); they should only be given in case the\r
+# language name is needed to interpret the given encoding alias\r
+# correctly (CJK codes often have this need).\r
+#\r
+# Note that the normalize() function which uses this tables\r
+# removes '_' and '-' characters from the encoding part of the\r
+# locale name before doing the lookup. This saves a lot of\r
+# space in the table.\r
+#\r
+# MAL 2004-12-10:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.4\r
+# and older):\r
+#\r
+#    updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'\r
+#    updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'\r
+#    updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'\r
+#    updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'\r
+#    updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'\r
+#    updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'\r
+#    updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'\r
+#    updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'\r
+#    updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'\r
+#    updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'\r
+#    updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'\r
+#    updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'\r
+#    updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'\r
+#    updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'\r
+#\r
+# MAL 2008-05-30:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.5\r
+# and older):\r
+#\r
+#    updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'\r
+#    updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'\r
+#    updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'\r
+#    updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'\r
+#    updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'\r
+#    updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#\r
+# AP 2010-04-12:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.6.5\r
+# and older):\r
+#\r
+#    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'\r
+#    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'\r
+#    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#    updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#    updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'\r
+#    updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#\r
+# SS 2013-12-20:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.7.6\r
+# and older):\r
+#\r
+#    updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'\r
+#    updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#    updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'\r
+#    updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#    updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#\r
+# SS 2014-10-01:\r
+# Updated alias mapping with glibc 2.19 supported locales.\r
+\r
+locale_alias = {\r
+    'a3':                                   'az_AZ.KOI8-C',\r
+    'a3_az':                                'az_AZ.KOI8-C',\r
+    'a3_az.koi8c':                          'az_AZ.KOI8-C',\r
+    'a3_az.koic':                           'az_AZ.KOI8-C',\r
+    'aa_dj':                                'aa_DJ.ISO8859-1',\r
+    'aa_er':                                'aa_ER.UTF-8',\r
+    'aa_et':                                'aa_ET.UTF-8',\r
+    'af':                                   'af_ZA.ISO8859-1',\r
+    'af_za':                                'af_ZA.ISO8859-1',\r
+    'af_za.iso88591':                       'af_ZA.ISO8859-1',\r
+    'am':                                   'am_ET.UTF-8',\r
+    'am_et':                                'am_ET.UTF-8',\r
+    'american':                             'en_US.ISO8859-1',\r
+    'american.iso88591':                    'en_US.ISO8859-1',\r
+    'an_es':                                'an_ES.ISO8859-15',\r
+    'ar':                                   'ar_AA.ISO8859-6',\r
+    'ar_aa':                                'ar_AA.ISO8859-6',\r
+    'ar_aa.iso88596':                       'ar_AA.ISO8859-6',\r
+    'ar_ae':                                'ar_AE.ISO8859-6',\r
+    'ar_ae.iso88596':                       'ar_AE.ISO8859-6',\r
+    'ar_bh':                                'ar_BH.ISO8859-6',\r
+    'ar_bh.iso88596':                       'ar_BH.ISO8859-6',\r
+    'ar_dz':                                'ar_DZ.ISO8859-6',\r
+    'ar_dz.iso88596':                       'ar_DZ.ISO8859-6',\r
+    'ar_eg':                                'ar_EG.ISO8859-6',\r
+    'ar_eg.iso88596':                       'ar_EG.ISO8859-6',\r
+    'ar_in':                                'ar_IN.UTF-8',\r
+    'ar_iq':                                'ar_IQ.ISO8859-6',\r
+    'ar_iq.iso88596':                       'ar_IQ.ISO8859-6',\r
+    'ar_jo':                                'ar_JO.ISO8859-6',\r
+    'ar_jo.iso88596':                       'ar_JO.ISO8859-6',\r
+    'ar_kw':                                'ar_KW.ISO8859-6',\r
+    'ar_kw.iso88596':                       'ar_KW.ISO8859-6',\r
+    'ar_lb':                                'ar_LB.ISO8859-6',\r
+    'ar_lb.iso88596':                       'ar_LB.ISO8859-6',\r
+    'ar_ly':                                'ar_LY.ISO8859-6',\r
+    'ar_ly.iso88596':                       'ar_LY.ISO8859-6',\r
+    'ar_ma':                                'ar_MA.ISO8859-6',\r
+    'ar_ma.iso88596':                       'ar_MA.ISO8859-6',\r
+    'ar_om':                                'ar_OM.ISO8859-6',\r
+    'ar_om.iso88596':                       'ar_OM.ISO8859-6',\r
+    'ar_qa':                                'ar_QA.ISO8859-6',\r
+    'ar_qa.iso88596':                       'ar_QA.ISO8859-6',\r
+    'ar_sa':                                'ar_SA.ISO8859-6',\r
+    'ar_sa.iso88596':                       'ar_SA.ISO8859-6',\r
+    'ar_sd':                                'ar_SD.ISO8859-6',\r
+    'ar_sd.iso88596':                       'ar_SD.ISO8859-6',\r
+    'ar_sy':                                'ar_SY.ISO8859-6',\r
+    'ar_sy.iso88596':                       'ar_SY.ISO8859-6',\r
+    'ar_tn':                                'ar_TN.ISO8859-6',\r
+    'ar_tn.iso88596':                       'ar_TN.ISO8859-6',\r
+    'ar_ye':                                'ar_YE.ISO8859-6',\r
+    'ar_ye.iso88596':                       'ar_YE.ISO8859-6',\r
+    'arabic':                               'ar_AA.ISO8859-6',\r
+    'arabic.iso88596':                      'ar_AA.ISO8859-6',\r
+    'as':                                   'as_IN.UTF-8',\r
+    'as_in':                                'as_IN.UTF-8',\r
+    'ast_es':                               'ast_ES.ISO8859-15',\r
+    'ayc_pe':                               'ayc_PE.UTF-8',\r
+    'az':                                   'az_AZ.ISO8859-9E',\r
+    'az_az':                                'az_AZ.ISO8859-9E',\r
+    'az_az.iso88599e':                      'az_AZ.ISO8859-9E',\r
+    'be':                                   'be_BY.CP1251',\r
+    'be@latin':                             'be_BY.UTF-8@latin',\r
+    'be_bg.utf8':                           'bg_BG.UTF-8',\r
+    'be_by':                                'be_BY.CP1251',\r
+    'be_by.cp1251':                         'be_BY.CP1251',\r
+    'be_by.microsoftcp1251':                'be_BY.CP1251',\r
+    'be_by.utf8@latin':                     'be_BY.UTF-8@latin',\r
+    'be_by@latin':                          'be_BY.UTF-8@latin',\r
+    'bem_zm':                               'bem_ZM.UTF-8',\r
+    'ber_dz':                               'ber_DZ.UTF-8',\r
+    'ber_ma':                               'ber_MA.UTF-8',\r
+    'bg':                                   'bg_BG.CP1251',\r
+    'bg_bg':                                'bg_BG.CP1251',\r
+    'bg_bg.cp1251':                         'bg_BG.CP1251',\r
+    'bg_bg.iso88595':                       'bg_BG.ISO8859-5',\r
+    'bg_bg.koi8r':                          'bg_BG.KOI8-R',\r
+    'bg_bg.microsoftcp1251':                'bg_BG.CP1251',\r
+    'bho_in':                               'bho_IN.UTF-8',\r
+    'bn_bd':                                'bn_BD.UTF-8',\r
+    'bn_in':                                'bn_IN.UTF-8',\r
+    'bo_cn':                                'bo_CN.UTF-8',\r
+    'bo_in':                                'bo_IN.UTF-8',\r
+    'bokmal':                               'nb_NO.ISO8859-1',\r
+    'bokm\xe5l':                            'nb_NO.ISO8859-1',\r
+    'br':                                   'br_FR.ISO8859-1',\r
+    'br_fr':                                'br_FR.ISO8859-1',\r
+    'br_fr.iso88591':                       'br_FR.ISO8859-1',\r
+    'br_fr.iso885914':                      'br_FR.ISO8859-14',\r
+    'br_fr.iso885915':                      'br_FR.ISO8859-15',\r
+    'br_fr.iso885915@euro':                 'br_FR.ISO8859-15',\r
+    'br_fr.utf8@euro':                      'br_FR.UTF-8',\r
+    'br_fr@euro':                           'br_FR.ISO8859-15',\r
+    'brx_in':                               'brx_IN.UTF-8',\r
+    'bs':                                   'bs_BA.ISO8859-2',\r
+    'bs_ba':                                'bs_BA.ISO8859-2',\r
+    'bs_ba.iso88592':                       'bs_BA.ISO8859-2',\r
+    'bulgarian':                            'bg_BG.CP1251',\r
+    'byn_er':                               'byn_ER.UTF-8',\r
+    'c':                                    'C',\r
+    'c-french':                             'fr_CA.ISO8859-1',\r
+    'c-french.iso88591':                    'fr_CA.ISO8859-1',\r
+    'c.ascii':                              'C',\r
+    'c.en':                                 'C',\r
+    'c.iso88591':                           'en_US.ISO8859-1',\r
+    'c.utf8':                               'en_US.UTF-8',\r
+    'c_c':                                  'C',\r
+    'c_c.c':                                'C',\r
+    'ca':                                   'ca_ES.ISO8859-1',\r
+    'ca_ad':                                'ca_AD.ISO8859-1',\r
+    'ca_ad.iso88591':                       'ca_AD.ISO8859-1',\r
+    'ca_ad.iso885915':                      'ca_AD.ISO8859-15',\r
+    'ca_ad.iso885915@euro':                 'ca_AD.ISO8859-15',\r
+    'ca_ad.utf8@euro':                      'ca_AD.UTF-8',\r
+    'ca_ad@euro':                           'ca_AD.ISO8859-15',\r
+    'ca_es':                                'ca_ES.ISO8859-1',\r
+    'ca_es.iso88591':                       'ca_ES.ISO8859-1',\r
+    'ca_es.iso885915':                      'ca_ES.ISO8859-15',\r
+    'ca_es.iso885915@euro':                 'ca_ES.ISO8859-15',\r
+    'ca_es.utf8@euro':                      'ca_ES.UTF-8',\r
+    'ca_es@valencia':                       'ca_ES.ISO8859-15@valencia',\r
+    'ca_es@euro':                           'ca_ES.ISO8859-15',\r
+    'ca_fr':                                'ca_FR.ISO8859-1',\r
+    'ca_fr.iso88591':                       'ca_FR.ISO8859-1',\r
+    'ca_fr.iso885915':                      'ca_FR.ISO8859-15',\r
+    'ca_fr.iso885915@euro':                 'ca_FR.ISO8859-15',\r
+    'ca_fr.utf8@euro':                      'ca_FR.UTF-8',\r
+    'ca_fr@euro':                           'ca_FR.ISO8859-15',\r
+    'ca_it':                                'ca_IT.ISO8859-1',\r
+    'ca_it.iso88591':                       'ca_IT.ISO8859-1',\r
+    'ca_it.iso885915':                      'ca_IT.ISO8859-15',\r
+    'ca_it.iso885915@euro':                 'ca_IT.ISO8859-15',\r
+    'ca_it.utf8@euro':                      'ca_IT.UTF-8',\r
+    'ca_it@euro':                           'ca_IT.ISO8859-15',\r
+    'catalan':                              'ca_ES.ISO8859-1',\r
+    'cextend':                              'en_US.ISO8859-1',\r
+    'cextend.en':                           'en_US.ISO8859-1',\r
+    'chinese-s':                            'zh_CN.eucCN',\r
+    'chinese-t':                            'zh_TW.eucTW',\r
+    'crh_ua':                               'crh_UA.UTF-8',\r
+    'croatian':                             'hr_HR.ISO8859-2',\r
+    'cs':                                   'cs_CZ.ISO8859-2',\r
+    'cs_cs':                                'cs_CZ.ISO8859-2',\r
+    'cs_cs.iso88592':                       'cs_CZ.ISO8859-2',\r
+    'cs_cz':                                'cs_CZ.ISO8859-2',\r
+    'cs_cz.iso88592':                       'cs_CZ.ISO8859-2',\r
+    'csb_pl':                               'csb_PL.UTF-8',\r
+    'cv_ru':                                'cv_RU.UTF-8',\r
+    'cy':                                   'cy_GB.ISO8859-1',\r
+    'cy_gb':                                'cy_GB.ISO8859-1',\r
+    'cy_gb.iso88591':                       'cy_GB.ISO8859-1',\r
+    'cy_gb.iso885914':                      'cy_GB.ISO8859-14',\r
+    'cy_gb.iso885915':                      'cy_GB.ISO8859-15',\r
+    'cy_gb@euro':                           'cy_GB.ISO8859-15',\r
+    'cz':                                   'cs_CZ.ISO8859-2',\r
+    'cz_cz':                                'cs_CZ.ISO8859-2',\r
+    'czech':                                'cs_CZ.ISO8859-2',\r
+    'da':                                   'da_DK.ISO8859-1',\r
+    'da.iso885915':                         'da_DK.ISO8859-15',\r
+    'da_dk':                                'da_DK.ISO8859-1',\r
+    'da_dk.88591':                          'da_DK.ISO8859-1',\r
+    'da_dk.885915':                         'da_DK.ISO8859-15',\r
+    'da_dk.iso88591':                       'da_DK.ISO8859-1',\r
+    'da_dk.iso885915':                      'da_DK.ISO8859-15',\r
+    'da_dk@euro':                           'da_DK.ISO8859-15',\r
+    'danish':                               'da_DK.ISO8859-1',\r
+    'danish.iso88591':                      'da_DK.ISO8859-1',\r
+    'dansk':                                'da_DK.ISO8859-1',\r
+    'de':                                   'de_DE.ISO8859-1',\r
+    'de.iso885915':                         'de_DE.ISO8859-15',\r
+    'de_at':                                'de_AT.ISO8859-1',\r
+    'de_at.iso88591':                       'de_AT.ISO8859-1',\r
+    'de_at.iso885915':                      'de_AT.ISO8859-15',\r
+    'de_at.iso885915@euro':                 'de_AT.ISO8859-15',\r
+    'de_at.utf8@euro':                      'de_AT.UTF-8',\r
+    'de_at@euro':                           'de_AT.ISO8859-15',\r
+    'de_be':                                'de_BE.ISO8859-1',\r
+    'de_be.iso88591':                       'de_BE.ISO8859-1',\r
+    'de_be.iso885915':                      'de_BE.ISO8859-15',\r
+    'de_be.iso885915@euro':                 'de_BE.ISO8859-15',\r
+    'de_be.utf8@euro':                      'de_BE.UTF-8',\r
+    'de_be@euro':                           'de_BE.ISO8859-15',\r
+    'de_ch':                                'de_CH.ISO8859-1',\r
+    'de_ch.iso88591':                       'de_CH.ISO8859-1',\r
+    'de_ch.iso885915':                      'de_CH.ISO8859-15',\r
+    'de_ch@euro':                           'de_CH.ISO8859-15',\r
+    'de_de':                                'de_DE.ISO8859-1',\r
+    'de_de.88591':                          'de_DE.ISO8859-1',\r
+    'de_de.885915':                         'de_DE.ISO8859-15',\r
+    'de_de.885915@euro':                    'de_DE.ISO8859-15',\r
+    'de_de.iso88591':                       'de_DE.ISO8859-1',\r
+    'de_de.iso885915':                      'de_DE.ISO8859-15',\r
+    'de_de.iso885915@euro':                 'de_DE.ISO8859-15',\r
+    'de_de.utf8@euro':                      'de_DE.UTF-8',\r
+    'de_de@euro':                           'de_DE.ISO8859-15',\r
+    'de_li.utf8':                           'de_LI.UTF-8',\r
+    'de_lu':                                'de_LU.ISO8859-1',\r
+    'de_lu.iso88591':                       'de_LU.ISO8859-1',\r
+    'de_lu.iso885915':                      'de_LU.ISO8859-15',\r
+    'de_lu.iso885915@euro':                 'de_LU.ISO8859-15',\r
+    'de_lu.utf8@euro':                      'de_LU.UTF-8',\r
+    'de_lu@euro':                           'de_LU.ISO8859-15',\r
+    'deutsch':                              'de_DE.ISO8859-1',\r
+    'doi_in':                               'doi_IN.UTF-8',\r
+    'dutch':                                'nl_NL.ISO8859-1',\r
+    'dutch.iso88591':                       'nl_BE.ISO8859-1',\r
+    'dv_mv':                                'dv_MV.UTF-8',\r
+    'dz_bt':                                'dz_BT.UTF-8',\r
+    'ee':                                   'ee_EE.ISO8859-4',\r
+    'ee_ee':                                'ee_EE.ISO8859-4',\r
+    'ee_ee.iso88594':                       'ee_EE.ISO8859-4',\r
+    'eesti':                                'et_EE.ISO8859-1',\r
+    'el':                                   'el_GR.ISO8859-7',\r
+    'el_cy':                                'el_CY.ISO8859-7',\r
+    'el_gr':                                'el_GR.ISO8859-7',\r
+    'el_gr.iso88597':                       'el_GR.ISO8859-7',\r
+    'el_gr@euro':                           'el_GR.ISO8859-15',\r
+    'en':                                   'en_US.ISO8859-1',\r
+    'en.iso88591':                          'en_US.ISO8859-1',\r
+    'en_ag':                                'en_AG.UTF-8',\r
+    'en_au':                                'en_AU.ISO8859-1',\r
+    'en_au.iso88591':                       'en_AU.ISO8859-1',\r
+    'en_be':                                'en_BE.ISO8859-1',\r
+    'en_be@euro':                           'en_BE.ISO8859-15',\r
+    'en_bw':                                'en_BW.ISO8859-1',\r
+    'en_bw.iso88591':                       'en_BW.ISO8859-1',\r
+    'en_ca':                                'en_CA.ISO8859-1',\r
+    'en_ca.iso88591':                       'en_CA.ISO8859-1',\r
+    'en_dk':                                'en_DK.ISO8859-1',\r
+    'en_dl.utf8':                           'en_DL.UTF-8',\r
+    'en_gb':                                'en_GB.ISO8859-1',\r
+    'en_gb.88591':                          'en_GB.ISO8859-1',\r
+    'en_gb.iso88591':                       'en_GB.ISO8859-1',\r
+    'en_gb.iso885915':                      'en_GB.ISO8859-15',\r
+    'en_gb@euro':                           'en_GB.ISO8859-15',\r
+    'en_hk':                                'en_HK.ISO8859-1',\r
+    'en_hk.iso88591':                       'en_HK.ISO8859-1',\r
+    'en_ie':                                'en_IE.ISO8859-1',\r
+    'en_ie.iso88591':                       'en_IE.ISO8859-1',\r
+    'en_ie.iso885915':                      'en_IE.ISO8859-15',\r
+    'en_ie.iso885915@euro':                 'en_IE.ISO8859-15',\r
+    'en_ie.utf8@euro':                      'en_IE.UTF-8',\r
+    'en_ie@euro':                           'en_IE.ISO8859-15',\r
+    'en_in':                                'en_IN.ISO8859-1',\r
+    'en_ng':                                'en_NG.UTF-8',\r
+    'en_nz':                                'en_NZ.ISO8859-1',\r
+    'en_nz.iso88591':                       'en_NZ.ISO8859-1',\r
+    'en_ph':                                'en_PH.ISO8859-1',\r
+    'en_ph.iso88591':                       'en_PH.ISO8859-1',\r
+    'en_sg':                                'en_SG.ISO8859-1',\r
+    'en_sg.iso88591':                       'en_SG.ISO8859-1',\r
+    'en_uk':                                'en_GB.ISO8859-1',\r
+    'en_us':                                'en_US.ISO8859-1',\r
+    'en_us.88591':                          'en_US.ISO8859-1',\r
+    'en_us.885915':                         'en_US.ISO8859-15',\r
+    'en_us.iso88591':                       'en_US.ISO8859-1',\r
+    'en_us.iso885915':                      'en_US.ISO8859-15',\r
+    'en_us.iso885915@euro':                 'en_US.ISO8859-15',\r
+    'en_us@euro':                           'en_US.ISO8859-15',\r
+    'en_us@euro@euro':                      'en_US.ISO8859-15',\r
+    'en_za':                                'en_ZA.ISO8859-1',\r
+    'en_za.88591':                          'en_ZA.ISO8859-1',\r
+    'en_za.iso88591':                       'en_ZA.ISO8859-1',\r
+    'en_za.iso885915':                      'en_ZA.ISO8859-15',\r
+    'en_za@euro':                           'en_ZA.ISO8859-15',\r
+    'en_zm':                                'en_ZM.UTF-8',\r
+    'en_zw':                                'en_ZW.ISO8859-1',\r
+    'en_zw.iso88591':                       'en_ZW.ISO8859-1',\r
+    'en_zw.utf8':                           'en_ZS.UTF-8',\r
+    'eng_gb':                               'en_GB.ISO8859-1',\r
+    'eng_gb.8859':                          'en_GB.ISO8859-1',\r
+    'english':                              'en_EN.ISO8859-1',\r
+    'english.iso88591':                     'en_EN.ISO8859-1',\r
+    'english_uk':                           'en_GB.ISO8859-1',\r
+    'english_uk.8859':                      'en_GB.ISO8859-1',\r
+    'english_united-states':                'en_US.ISO8859-1',\r
+    'english_united-states.437':            'C',\r
+    'english_us':                           'en_US.ISO8859-1',\r
+    'english_us.8859':                      'en_US.ISO8859-1',\r
+    'english_us.ascii':                     'en_US.ISO8859-1',\r
+    'eo':                                   'eo_XX.ISO8859-3',\r
+    'eo.utf8':                              'eo.UTF-8',\r
+    'eo_eo':                                'eo_EO.ISO8859-3',\r
+    'eo_eo.iso88593':                       'eo_EO.ISO8859-3',\r
+    'eo_us.utf8':                           'eo_US.UTF-8',\r
+    'eo_xx':                                'eo_XX.ISO8859-3',\r
+    'eo_xx.iso88593':                       'eo_XX.ISO8859-3',\r
+    'es':                                   'es_ES.ISO8859-1',\r
+    'es_ar':                                'es_AR.ISO8859-1',\r
+    'es_ar.iso88591':                       'es_AR.ISO8859-1',\r
+    'es_bo':                                'es_BO.ISO8859-1',\r
+    'es_bo.iso88591':                       'es_BO.ISO8859-1',\r
+    'es_cl':                                'es_CL.ISO8859-1',\r
+    'es_cl.iso88591':                       'es_CL.ISO8859-1',\r
+    'es_co':                                'es_CO.ISO8859-1',\r
+    'es_co.iso88591':                       'es_CO.ISO8859-1',\r
+    'es_cr':                                'es_CR.ISO8859-1',\r
+    'es_cr.iso88591':                       'es_CR.ISO8859-1',\r
+    'es_cu':                                'es_CU.UTF-8',\r
+    'es_do':                                'es_DO.ISO8859-1',\r
+    'es_do.iso88591':                       'es_DO.ISO8859-1',\r
+    'es_ec':                                'es_EC.ISO8859-1',\r
+    'es_ec.iso88591':                       'es_EC.ISO8859-1',\r
+    'es_es':                                'es_ES.ISO8859-1',\r
+    'es_es.88591':                          'es_ES.ISO8859-1',\r
+    'es_es.iso88591':                       'es_ES.ISO8859-1',\r
+    'es_es.iso885915':                      'es_ES.ISO8859-15',\r
+    'es_es.iso885915@euro':                 'es_ES.ISO8859-15',\r
+    'es_es.utf8@euro':                      'es_ES.UTF-8',\r
+    'es_es@euro':                           'es_ES.ISO8859-15',\r
+    'es_gt':                                'es_GT.ISO8859-1',\r
+    'es_gt.iso88591':                       'es_GT.ISO8859-1',\r
+    'es_hn':                                'es_HN.ISO8859-1',\r
+    'es_hn.iso88591':                       'es_HN.ISO8859-1',\r
+    'es_mx':                                'es_MX.ISO8859-1',\r
+    'es_mx.iso88591':                       'es_MX.ISO8859-1',\r
+    'es_ni':                                'es_NI.ISO8859-1',\r
+    'es_ni.iso88591':                       'es_NI.ISO8859-1',\r
+    'es_pa':                                'es_PA.ISO8859-1',\r
+    'es_pa.iso88591':                       'es_PA.ISO8859-1',\r
+    'es_pa.iso885915':                      'es_PA.ISO8859-15',\r
+    'es_pa@euro':                           'es_PA.ISO8859-15',\r
+    'es_pe':                                'es_PE.ISO8859-1',\r
+    'es_pe.iso88591':                       'es_PE.ISO8859-1',\r
+    'es_pe.iso885915':                      'es_PE.ISO8859-15',\r
+    'es_pe@euro':                           'es_PE.ISO8859-15',\r
+    'es_pr':                                'es_PR.ISO8859-1',\r
+    'es_pr.iso88591':                       'es_PR.ISO8859-1',\r
+    'es_py':                                'es_PY.ISO8859-1',\r
+    'es_py.iso88591':                       'es_PY.ISO8859-1',\r
+    'es_py.iso885915':                      'es_PY.ISO8859-15',\r
+    'es_py@euro':                           'es_PY.ISO8859-15',\r
+    'es_sv':                                'es_SV.ISO8859-1',\r
+    'es_sv.iso88591':                       'es_SV.ISO8859-1',\r
+    'es_sv.iso885915':                      'es_SV.ISO8859-15',\r
+    'es_sv@euro':                           'es_SV.ISO8859-15',\r
+    'es_us':                                'es_US.ISO8859-1',\r
+    'es_us.iso88591':                       'es_US.ISO8859-1',\r
+    'es_uy':                                'es_UY.ISO8859-1',\r
+    'es_uy.iso88591':                       'es_UY.ISO8859-1',\r
+    'es_uy.iso885915':                      'es_UY.ISO8859-15',\r
+    'es_uy@euro':                           'es_UY.ISO8859-15',\r
+    'es_ve':                                'es_VE.ISO8859-1',\r
+    'es_ve.iso88591':                       'es_VE.ISO8859-1',\r
+    'es_ve.iso885915':                      'es_VE.ISO8859-15',\r
+    'es_ve@euro':                           'es_VE.ISO8859-15',\r
+    'estonian':                             'et_EE.ISO8859-1',\r
+    'et':                                   'et_EE.ISO8859-15',\r
+    'et_ee':                                'et_EE.ISO8859-15',\r
+    'et_ee.iso88591':                       'et_EE.ISO8859-1',\r
+    'et_ee.iso885913':                      'et_EE.ISO8859-13',\r
+    'et_ee.iso885915':                      'et_EE.ISO8859-15',\r
+    'et_ee.iso88594':                       'et_EE.ISO8859-4',\r
+    'et_ee@euro':                           'et_EE.ISO8859-15',\r
+    'eu':                                   'eu_ES.ISO8859-1',\r
+    'eu_es':                                'eu_ES.ISO8859-1',\r
+    'eu_es.iso88591':                       'eu_ES.ISO8859-1',\r
+    'eu_es.iso885915':                      'eu_ES.ISO8859-15',\r
+    'eu_es.iso885915@euro':                 'eu_ES.ISO8859-15',\r
+    'eu_es.utf8@euro':                      'eu_ES.UTF-8',\r
+    'eu_es@euro':                           'eu_ES.ISO8859-15',\r
+    'eu_fr':                                'eu_FR.ISO8859-1',\r
+    'fa':                                   'fa_IR.UTF-8',\r
+    'fa_ir':                                'fa_IR.UTF-8',\r
+    'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',\r
+    'ff_sn':                                'ff_SN.UTF-8',\r
+    'fi':                                   'fi_FI.ISO8859-15',\r
+    'fi.iso885915':                         'fi_FI.ISO8859-15',\r
+    'fi_fi':                                'fi_FI.ISO8859-15',\r
+    'fi_fi.88591':                          'fi_FI.ISO8859-1',\r
+    'fi_fi.iso88591':                       'fi_FI.ISO8859-1',\r
+    'fi_fi.iso885915':                      'fi_FI.ISO8859-15',\r
+    'fi_fi.iso885915@euro':                 'fi_FI.ISO8859-15',\r
+    'fi_fi.utf8@euro':                      'fi_FI.UTF-8',\r
+    'fi_fi@euro':                           'fi_FI.ISO8859-15',\r
+    'fil_ph':                               'fil_PH.UTF-8',\r
+    'finnish':                              'fi_FI.ISO8859-1',\r
+    'finnish.iso88591':                     'fi_FI.ISO8859-1',\r
+    'fo':                                   'fo_FO.ISO8859-1',\r
+    'fo_fo':                                'fo_FO.ISO8859-1',\r
+    'fo_fo.iso88591':                       'fo_FO.ISO8859-1',\r
+    'fo_fo.iso885915':                      'fo_FO.ISO8859-15',\r
+    'fo_fo@euro':                           'fo_FO.ISO8859-15',\r
+    'fr':                                   'fr_FR.ISO8859-1',\r
+    'fr.iso885915':                         'fr_FR.ISO8859-15',\r
+    'fr_be':                                'fr_BE.ISO8859-1',\r
+    'fr_be.88591':                          'fr_BE.ISO8859-1',\r
+    'fr_be.iso88591':                       'fr_BE.ISO8859-1',\r
+    'fr_be.iso885915':                      'fr_BE.ISO8859-15',\r
+    'fr_be.iso885915@euro':                 'fr_BE.ISO8859-15',\r
+    'fr_be.utf8@euro':                      'fr_BE.UTF-8',\r
+    'fr_be@euro':                           'fr_BE.ISO8859-15',\r
+    'fr_ca':                                'fr_CA.ISO8859-1',\r
+    'fr_ca.88591':                          'fr_CA.ISO8859-1',\r
+    'fr_ca.iso88591':                       'fr_CA.ISO8859-1',\r
+    'fr_ca.iso885915':                      'fr_CA.ISO8859-15',\r
+    'fr_ca@euro':                           'fr_CA.ISO8859-15',\r
+    'fr_ch':                                'fr_CH.ISO8859-1',\r
+    'fr_ch.88591':                          'fr_CH.ISO8859-1',\r
+    'fr_ch.iso88591':                       'fr_CH.ISO8859-1',\r
+    'fr_ch.iso885915':                      'fr_CH.ISO8859-15',\r
+    'fr_ch@euro':                           'fr_CH.ISO8859-15',\r
+    'fr_fr':                                'fr_FR.ISO8859-1',\r
+    'fr_fr.88591':                          'fr_FR.ISO8859-1',\r
+    'fr_fr.iso88591':                       'fr_FR.ISO8859-1',\r
+    'fr_fr.iso885915':                      'fr_FR.ISO8859-15',\r
+    'fr_fr.iso885915@euro':                 'fr_FR.ISO8859-15',\r
+    'fr_fr.utf8@euro':                      'fr_FR.UTF-8',\r
+    'fr_fr@euro':                           'fr_FR.ISO8859-15',\r
+    'fr_lu':                                'fr_LU.ISO8859-1',\r
+    'fr_lu.88591':                          'fr_LU.ISO8859-1',\r
+    'fr_lu.iso88591':                       'fr_LU.ISO8859-1',\r
+    'fr_lu.iso885915':                      'fr_LU.ISO8859-15',\r
+    'fr_lu.iso885915@euro':                 'fr_LU.ISO8859-15',\r
+    'fr_lu.utf8@euro':                      'fr_LU.UTF-8',\r
+    'fr_lu@euro':                           'fr_LU.ISO8859-15',\r
+    'fran\xe7ais':                          'fr_FR.ISO8859-1',\r
+    'fre_fr':                               'fr_FR.ISO8859-1',\r
+    'fre_fr.8859':                          'fr_FR.ISO8859-1',\r
+    'french':                               'fr_FR.ISO8859-1',\r
+    'french.iso88591':                      'fr_CH.ISO8859-1',\r
+    'french_france':                        'fr_FR.ISO8859-1',\r
+    'french_france.8859':                   'fr_FR.ISO8859-1',\r
+    'fur_it':                               'fur_IT.UTF-8',\r
+    'fy_de':                                'fy_DE.UTF-8',\r
+    'fy_nl':                                'fy_NL.UTF-8',\r
+    'ga':                                   'ga_IE.ISO8859-1',\r
+    'ga_ie':                                'ga_IE.ISO8859-1',\r
+    'ga_ie.iso88591':                       'ga_IE.ISO8859-1',\r
+    'ga_ie.iso885914':                      'ga_IE.ISO8859-14',\r
+    'ga_ie.iso885915':                      'ga_IE.ISO8859-15',\r
+    'ga_ie.iso885915@euro':                 'ga_IE.ISO8859-15',\r
+    'ga_ie.utf8@euro':                      'ga_IE.UTF-8',\r
+    'ga_ie@euro':                           'ga_IE.ISO8859-15',\r
+    'galego':                               'gl_ES.ISO8859-1',\r
+    'galician':                             'gl_ES.ISO8859-1',\r
+    'gd':                                   'gd_GB.ISO8859-1',\r
+    'gd_gb':                                'gd_GB.ISO8859-1',\r
+    'gd_gb.iso88591':                       'gd_GB.ISO8859-1',\r
+    'gd_gb.iso885914':                      'gd_GB.ISO8859-14',\r
+    'gd_gb.iso885915':                      'gd_GB.ISO8859-15',\r
+    'gd_gb@euro':                           'gd_GB.ISO8859-15',\r
+    'ger_de':                               'de_DE.ISO8859-1',\r
+    'ger_de.8859':                          'de_DE.ISO8859-1',\r
+    'german':                               'de_DE.ISO8859-1',\r
+    'german.iso88591':                      'de_CH.ISO8859-1',\r
+    'german_germany':                       'de_DE.ISO8859-1',\r
+    'german_germany.8859':                  'de_DE.ISO8859-1',\r
+    'gez_er':                               'gez_ER.UTF-8',\r
+    'gez_et':                               'gez_ET.UTF-8',\r
+    'gl':                                   'gl_ES.ISO8859-1',\r
+    'gl_es':                                'gl_ES.ISO8859-1',\r
+    'gl_es.iso88591':                       'gl_ES.ISO8859-1',\r
+    'gl_es.iso885915':                      'gl_ES.ISO8859-15',\r
+    'gl_es.iso885915@euro':                 'gl_ES.ISO8859-15',\r
+    'gl_es.utf8@euro':                      'gl_ES.UTF-8',\r
+    'gl_es@euro':                           'gl_ES.ISO8859-15',\r
+    'greek':                                'el_GR.ISO8859-7',\r
+    'greek.iso88597':                       'el_GR.ISO8859-7',\r
+    'gu_in':                                'gu_IN.UTF-8',\r
+    'gv':                                   'gv_GB.ISO8859-1',\r
+    'gv_gb':                                'gv_GB.ISO8859-1',\r
+    'gv_gb.iso88591':                       'gv_GB.ISO8859-1',\r
+    'gv_gb.iso885914':                      'gv_GB.ISO8859-14',\r
+    'gv_gb.iso885915':                      'gv_GB.ISO8859-15',\r
+    'gv_gb@euro':                           'gv_GB.ISO8859-15',\r
+    'ha_ng':                                'ha_NG.UTF-8',\r
+    'he':                                   'he_IL.ISO8859-8',\r
+    'he_il':                                'he_IL.ISO8859-8',\r
+    'he_il.cp1255':                         'he_IL.CP1255',\r
+    'he_il.iso88598':                       'he_IL.ISO8859-8',\r
+    'he_il.microsoftcp1255':                'he_IL.CP1255',\r
+    'hebrew':                               'he_IL.ISO8859-8',\r
+    'hebrew.iso88598':                      'he_IL.ISO8859-8',\r
+    'hi':                                   'hi_IN.ISCII-DEV',\r
+    'hi_in':                                'hi_IN.ISCII-DEV',\r
+    'hi_in.isciidev':                       'hi_IN.ISCII-DEV',\r
+    'hne':                                  'hne_IN.UTF-8',\r
+    'hne_in':                               'hne_IN.UTF-8',\r
+    'hr':                                   'hr_HR.ISO8859-2',\r
+    'hr_hr':                                'hr_HR.ISO8859-2',\r
+    'hr_hr.iso88592':                       'hr_HR.ISO8859-2',\r
+    'hrvatski':                             'hr_HR.ISO8859-2',\r
+    'hsb_de':                               'hsb_DE.ISO8859-2',\r
+    'ht_ht':                                'ht_HT.UTF-8',\r
+    'hu':                                   'hu_HU.ISO8859-2',\r
+    'hu_hu':                                'hu_HU.ISO8859-2',\r
+    'hu_hu.iso88592':                       'hu_HU.ISO8859-2',\r
+    'hungarian':                            'hu_HU.ISO8859-2',\r
+    'hy_am':                                'hy_AM.UTF-8',\r
+    'hy_am.armscii8':                       'hy_AM.ARMSCII_8',\r
+    'ia':                                   'ia.UTF-8',\r
+    'ia_fr':                                'ia_FR.UTF-8',\r
+    'icelandic':                            'is_IS.ISO8859-1',\r
+    'icelandic.iso88591':                   'is_IS.ISO8859-1',\r
+    'id':                                   'id_ID.ISO8859-1',\r
+    'id_id':                                'id_ID.ISO8859-1',\r
+    'ig_ng':                                'ig_NG.UTF-8',\r
+    'ik_ca':                                'ik_CA.UTF-8',\r
+    'in':                                   'id_ID.ISO8859-1',\r
+    'in_id':                                'id_ID.ISO8859-1',\r
+    'is':                                   'is_IS.ISO8859-1',\r
+    'is_is':                                'is_IS.ISO8859-1',\r
+    'is_is.iso88591':                       'is_IS.ISO8859-1',\r
+    'is_is.iso885915':                      'is_IS.ISO8859-15',\r
+    'is_is@euro':                           'is_IS.ISO8859-15',\r
+    'iso-8859-1':                           'en_US.ISO8859-1',\r
+    'iso-8859-15':                          'en_US.ISO8859-15',\r
+    'iso8859-1':                            'en_US.ISO8859-1',\r
+    'iso8859-15':                           'en_US.ISO8859-15',\r
+    'iso_8859_1':                           'en_US.ISO8859-1',\r
+    'iso_8859_15':                          'en_US.ISO8859-15',\r
+    'it':                                   'it_IT.ISO8859-1',\r
+    'it.iso885915':                         'it_IT.ISO8859-15',\r
+    'it_ch':                                'it_CH.ISO8859-1',\r
+    'it_ch.iso88591':                       'it_CH.ISO8859-1',\r
+    'it_ch.iso885915':                      'it_CH.ISO8859-15',\r
+    'it_ch@euro':                           'it_CH.ISO8859-15',\r
+    'it_it':                                'it_IT.ISO8859-1',\r
+    'it_it.88591':                          'it_IT.ISO8859-1',\r
+    'it_it.iso88591':                       'it_IT.ISO8859-1',\r
+    'it_it.iso885915':                      'it_IT.ISO8859-15',\r
+    'it_it.iso885915@euro':                 'it_IT.ISO8859-15',\r
+    'it_it.utf8@euro':                      'it_IT.UTF-8',\r
+    'it_it@euro':                           'it_IT.ISO8859-15',\r
+    'italian':                              'it_IT.ISO8859-1',\r
+    'italian.iso88591':                     'it_IT.ISO8859-1',\r
+    'iu':                                   'iu_CA.NUNACOM-8',\r
+    'iu_ca':                                'iu_CA.NUNACOM-8',\r
+    'iu_ca.nunacom8':                       'iu_CA.NUNACOM-8',\r
+    'iw':                                   'he_IL.ISO8859-8',\r
+    'iw_il':                                'he_IL.ISO8859-8',\r
+    'iw_il.iso88598':                       'he_IL.ISO8859-8',\r
+    'iw_il.utf8':                           'iw_IL.UTF-8',\r
+    'ja':                                   'ja_JP.eucJP',\r
+    'ja.jis':                               'ja_JP.JIS7',\r
+    'ja.sjis':                              'ja_JP.SJIS',\r
+    'ja_jp':                                'ja_JP.eucJP',\r
+    'ja_jp.ajec':                           'ja_JP.eucJP',\r
+    'ja_jp.euc':                            'ja_JP.eucJP',\r
+    'ja_jp.eucjp':                          'ja_JP.eucJP',\r
+    'ja_jp.iso-2022-jp':                    'ja_JP.JIS7',\r
+    'ja_jp.iso2022jp':                      'ja_JP.JIS7',\r
+    'ja_jp.jis':                            'ja_JP.JIS7',\r
+    'ja_jp.jis7':                           'ja_JP.JIS7',\r
+    'ja_jp.mscode':                         'ja_JP.SJIS',\r
+    'ja_jp.pck':                            'ja_JP.SJIS',\r
+    'ja_jp.sjis':                           'ja_JP.SJIS',\r
+    'ja_jp.ujis':                           'ja_JP.eucJP',\r
+    'japan':                                'ja_JP.eucJP',\r
+    'japanese':                             'ja_JP.eucJP',\r
+    'japanese-euc':                         'ja_JP.eucJP',\r
+    'japanese.euc':                         'ja_JP.eucJP',\r
+    'japanese.sjis':                        'ja_JP.SJIS',\r
+    'jp_jp':                                'ja_JP.eucJP',\r
+    'ka':                                   'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge':                                'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',\r
+    'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',\r
+    'kk_kz':                                'kk_KZ.RK1048',\r
+    'kl':                                   'kl_GL.ISO8859-1',\r
+    'kl_gl':                                'kl_GL.ISO8859-1',\r
+    'kl_gl.iso88591':                       'kl_GL.ISO8859-1',\r
+    'kl_gl.iso885915':                      'kl_GL.ISO8859-15',\r
+    'kl_gl@euro':                           'kl_GL.ISO8859-15',\r
+    'km_kh':                                'km_KH.UTF-8',\r
+    'kn':                                   'kn_IN.UTF-8',\r
+    'kn_in':                                'kn_IN.UTF-8',\r
+    'ko':                                   'ko_KR.eucKR',\r
+    'ko_kr':                                'ko_KR.eucKR',\r
+    'ko_kr.euc':                            'ko_KR.eucKR',\r
+    'ko_kr.euckr':                          'ko_KR.eucKR',\r
+    'kok_in':                               'kok_IN.UTF-8',\r
+    'korean':                               'ko_KR.eucKR',\r
+    'korean.euc':                           'ko_KR.eucKR',\r
+    'ks':                                   'ks_IN.UTF-8',\r
+    'ks_in':                                'ks_IN.UTF-8',\r
+    'ks_in@devanagari':                     'ks_IN.UTF-8@devanagari',\r
+    'ks_in@devanagari.utf8':                'ks_IN.UTF-8@devanagari',\r
+    'ku_tr':                                'ku_TR.ISO8859-9',\r
+    'kw':                                   'kw_GB.ISO8859-1',\r
+    'kw_gb':                                'kw_GB.ISO8859-1',\r
+    'kw_gb.iso88591':                       'kw_GB.ISO8859-1',\r
+    'kw_gb.iso885914':                      'kw_GB.ISO8859-14',\r
+    'kw_gb.iso885915':                      'kw_GB.ISO8859-15',\r
+    'kw_gb@euro':                           'kw_GB.ISO8859-15',\r
+    'ky':                                   'ky_KG.UTF-8',\r
+    'ky_kg':                                'ky_KG.UTF-8',\r
+    'lb_lu':                                'lb_LU.UTF-8',\r
+    'lg_ug':                                'lg_UG.ISO8859-10',\r
+    'li_be':                                'li_BE.UTF-8',\r
+    'li_nl':                                'li_NL.UTF-8',\r
+    'lij_it':                               'lij_IT.UTF-8',\r
+    'lithuanian':                           'lt_LT.ISO8859-13',\r
+    'lo':                                   'lo_LA.MULELAO-1',\r
+    'lo_la':                                'lo_LA.MULELAO-1',\r
+    'lo_la.cp1133':                         'lo_LA.IBM-CP1133',\r
+    'lo_la.ibmcp1133':                      'lo_LA.IBM-CP1133',\r
+    'lo_la.mulelao1':                       'lo_LA.MULELAO-1',\r
+    'lt':                                   'lt_LT.ISO8859-13',\r
+    'lt_lt':                                'lt_LT.ISO8859-13',\r
+    'lt_lt.iso885913':                      'lt_LT.ISO8859-13',\r
+    'lt_lt.iso88594':                       'lt_LT.ISO8859-4',\r
+    'lv':                                   'lv_LV.ISO8859-13',\r
+    'lv_lv':                                'lv_LV.ISO8859-13',\r
+    'lv_lv.iso885913':                      'lv_LV.ISO8859-13',\r
+    'lv_lv.iso88594':                       'lv_LV.ISO8859-4',\r
+    'mag_in':                               'mag_IN.UTF-8',\r
+    'mai':                                  'mai_IN.UTF-8',\r
+    'mai_in':                               'mai_IN.UTF-8',\r
+    'mg_mg':                                'mg_MG.ISO8859-15',\r
+    'mhr_ru':                               'mhr_RU.UTF-8',\r
+    'mi':                                   'mi_NZ.ISO8859-1',\r
+    'mi_nz':                                'mi_NZ.ISO8859-1',\r
+    'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',\r
+    'mk':                                   'mk_MK.ISO8859-5',\r
+    'mk_mk':                                'mk_MK.ISO8859-5',\r
+    'mk_mk.cp1251':                         'mk_MK.CP1251',\r
+    'mk_mk.iso88595':                       'mk_MK.ISO8859-5',\r
+    'mk_mk.microsoftcp1251':                'mk_MK.CP1251',\r
+    'ml':                                   'ml_IN.UTF-8',\r
+    'ml_in':                                'ml_IN.UTF-8',\r
+    'mn_mn':                                'mn_MN.UTF-8',\r
+    'mni_in':                               'mni_IN.UTF-8',\r
+    'mr':                                   'mr_IN.UTF-8',\r
+    'mr_in':                                'mr_IN.UTF-8',\r
+    'ms':                                   'ms_MY.ISO8859-1',\r
+    'ms_my':                                'ms_MY.ISO8859-1',\r
+    'ms_my.iso88591':                       'ms_MY.ISO8859-1',\r
+    'mt':                                   'mt_MT.ISO8859-3',\r
+    'mt_mt':                                'mt_MT.ISO8859-3',\r
+    'mt_mt.iso88593':                       'mt_MT.ISO8859-3',\r
+    'my_mm':                                'my_MM.UTF-8',\r
+    'nan_tw@latin':                         'nan_TW.UTF-8@latin',\r
+    'nb':                                   'nb_NO.ISO8859-1',\r
+    'nb_no':                                'nb_NO.ISO8859-1',\r
+    'nb_no.88591':                          'nb_NO.ISO8859-1',\r
+    'nb_no.iso88591':                       'nb_NO.ISO8859-1',\r
+    'nb_no.iso885915':                      'nb_NO.ISO8859-15',\r
+    'nb_no@euro':                           'nb_NO.ISO8859-15',\r
+    'nds_de':                               'nds_DE.UTF-8',\r
+    'nds_nl':                               'nds_NL.UTF-8',\r
+    'ne_np':                                'ne_NP.UTF-8',\r
+    'nhn_mx':                               'nhn_MX.UTF-8',\r
+    'niu_nu':                               'niu_NU.UTF-8',\r
+    'niu_nz':                               'niu_NZ.UTF-8',\r
+    'nl':                                   'nl_NL.ISO8859-1',\r
+    'nl.iso885915':                         'nl_NL.ISO8859-15',\r
+    'nl_aw':                                'nl_AW.UTF-8',\r
+    'nl_be':                                'nl_BE.ISO8859-1',\r
+    'nl_be.88591':                          'nl_BE.ISO8859-1',\r
+    'nl_be.iso88591':                       'nl_BE.ISO8859-1',\r
+    'nl_be.iso885915':                      'nl_BE.ISO8859-15',\r
+    'nl_be.iso885915@euro':                 'nl_BE.ISO8859-15',\r
+    'nl_be.utf8@euro':                      'nl_BE.UTF-8',\r
+    'nl_be@euro':                           'nl_BE.ISO8859-15',\r
+    'nl_nl':                                'nl_NL.ISO8859-1',\r
+    'nl_nl.88591':                          'nl_NL.ISO8859-1',\r
+    'nl_nl.iso88591':                       'nl_NL.ISO8859-1',\r
+    'nl_nl.iso885915':                      'nl_NL.ISO8859-15',\r
+    'nl_nl.iso885915@euro':                 'nl_NL.ISO8859-15',\r
+    'nl_nl.utf8@euro':                      'nl_NL.UTF-8',\r
+    'nl_nl@euro':                           'nl_NL.ISO8859-15',\r
+    'nn':                                   'nn_NO.ISO8859-1',\r
+    'nn_no':                                'nn_NO.ISO8859-1',\r
+    'nn_no.88591':                          'nn_NO.ISO8859-1',\r
+    'nn_no.iso88591':                       'nn_NO.ISO8859-1',\r
+    'nn_no.iso885915':                      'nn_NO.ISO8859-15',\r
+    'nn_no@euro':                           'nn_NO.ISO8859-15',\r
+    'no':                                   'no_NO.ISO8859-1',\r
+    'no@nynorsk':                           'ny_NO.ISO8859-1',\r
+    'no_no':                                'no_NO.ISO8859-1',\r
+    'no_no.88591':                          'no_NO.ISO8859-1',\r
+    'no_no.iso88591':                       'no_NO.ISO8859-1',\r
+    'no_no.iso885915':                      'no_NO.ISO8859-15',\r
+    'no_no.iso88591@bokmal':                'no_NO.ISO8859-1',\r
+    'no_no.iso88591@nynorsk':               'no_NO.ISO8859-1',\r
+    'no_no@euro':                           'no_NO.ISO8859-15',\r
+    'norwegian':                            'no_NO.ISO8859-1',\r
+    'norwegian.iso88591':                   'no_NO.ISO8859-1',\r
+    'nr':                                   'nr_ZA.ISO8859-1',\r
+    'nr_za':                                'nr_ZA.ISO8859-1',\r
+    'nr_za.iso88591':                       'nr_ZA.ISO8859-1',\r
+    'nso':                                  'nso_ZA.ISO8859-15',\r
+    'nso_za':                               'nso_ZA.ISO8859-15',\r
+    'nso_za.iso885915':                     'nso_ZA.ISO8859-15',\r
+    'ny':                                   'ny_NO.ISO8859-1',\r
+    'ny_no':                                'ny_NO.ISO8859-1',\r
+    'ny_no.88591':                          'ny_NO.ISO8859-1',\r
+    'ny_no.iso88591':                       'ny_NO.ISO8859-1',\r
+    'ny_no.iso885915':                      'ny_NO.ISO8859-15',\r
+    'ny_no@euro':                           'ny_NO.ISO8859-15',\r
+    'nynorsk':                              'nn_NO.ISO8859-1',\r
+    'oc':                                   'oc_FR.ISO8859-1',\r
+    'oc_fr':                                'oc_FR.ISO8859-1',\r
+    'oc_fr.iso88591':                       'oc_FR.ISO8859-1',\r
+    'oc_fr.iso885915':                      'oc_FR.ISO8859-15',\r
+    'oc_fr@euro':                           'oc_FR.ISO8859-15',\r
+    'om_et':                                'om_ET.UTF-8',\r
+    'om_ke':                                'om_KE.ISO8859-1',\r
+    'or':                                   'or_IN.UTF-8',\r
+    'or_in':                                'or_IN.UTF-8',\r
+    'os_ru':                                'os_RU.UTF-8',\r
+    'pa':                                   'pa_IN.UTF-8',\r
+    'pa_in':                                'pa_IN.UTF-8',\r
+    'pa_pk':                                'pa_PK.UTF-8',\r
+    'pap_an':                               'pap_AN.UTF-8',\r
+    'pd':                                   'pd_US.ISO8859-1',\r
+    'pd_de':                                'pd_DE.ISO8859-1',\r
+    'pd_de.iso88591':                       'pd_DE.ISO8859-1',\r
+    'pd_de.iso885915':                      'pd_DE.ISO8859-15',\r
+    'pd_de@euro':                           'pd_DE.ISO8859-15',\r
+    'pd_us':                                'pd_US.ISO8859-1',\r
+    'pd_us.iso88591':                       'pd_US.ISO8859-1',\r
+    'pd_us.iso885915':                      'pd_US.ISO8859-15',\r
+    'pd_us@euro':                           'pd_US.ISO8859-15',\r
+    'ph':                                   'ph_PH.ISO8859-1',\r
+    'ph_ph':                                'ph_PH.ISO8859-1',\r
+    'ph_ph.iso88591':                       'ph_PH.ISO8859-1',\r
+    'pl':                                   'pl_PL.ISO8859-2',\r
+    'pl_pl':                                'pl_PL.ISO8859-2',\r
+    'pl_pl.iso88592':                       'pl_PL.ISO8859-2',\r
+    'polish':                               'pl_PL.ISO8859-2',\r
+    'portuguese':                           'pt_PT.ISO8859-1',\r
+    'portuguese.iso88591':                  'pt_PT.ISO8859-1',\r
+    'portuguese_brazil':                    'pt_BR.ISO8859-1',\r
+    'portuguese_brazil.8859':               'pt_BR.ISO8859-1',\r
+    'posix':                                'C',\r
+    'posix-utf2':                           'C',\r
+    'pp':                                   'pp_AN.ISO8859-1',\r
+    'pp_an':                                'pp_AN.ISO8859-1',\r
+    'pp_an.iso88591':                       'pp_AN.ISO8859-1',\r
+    'ps_af':                                'ps_AF.UTF-8',\r
+    'pt':                                   'pt_PT.ISO8859-1',\r
+    'pt.iso885915':                         'pt_PT.ISO8859-15',\r
+    'pt_br':                                'pt_BR.ISO8859-1',\r
+    'pt_br.88591':                          'pt_BR.ISO8859-1',\r
+    'pt_br.iso88591':                       'pt_BR.ISO8859-1',\r
+    'pt_br.iso885915':                      'pt_BR.ISO8859-15',\r
+    'pt_br@euro':                           'pt_BR.ISO8859-15',\r
+    'pt_pt':                                'pt_PT.ISO8859-1',\r
+    'pt_pt.88591':                          'pt_PT.ISO8859-1',\r
+    'pt_pt.iso88591':                       'pt_PT.ISO8859-1',\r
+    'pt_pt.iso885915':                      'pt_PT.ISO8859-15',\r
+    'pt_pt.iso885915@euro':                 'pt_PT.ISO8859-15',\r
+    'pt_pt.utf8@euro':                      'pt_PT.UTF-8',\r
+    'pt_pt@euro':                           'pt_PT.ISO8859-15',\r
+    'ro':                                   'ro_RO.ISO8859-2',\r
+    'ro_ro':                                'ro_RO.ISO8859-2',\r
+    'ro_ro.iso88592':                       'ro_RO.ISO8859-2',\r
+    'romanian':                             'ro_RO.ISO8859-2',\r
+    'ru':                                   'ru_RU.UTF-8',\r
+    'ru.koi8r':                             'ru_RU.KOI8-R',\r
+    'ru_ru':                                'ru_RU.UTF-8',\r
+    'ru_ru.cp1251':                         'ru_RU.CP1251',\r
+    'ru_ru.iso88595':                       'ru_RU.ISO8859-5',\r
+    'ru_ru.koi8r':                          'ru_RU.KOI8-R',\r
+    'ru_ru.microsoftcp1251':                'ru_RU.CP1251',\r
+    'ru_ua':                                'ru_UA.KOI8-U',\r
+    'ru_ua.cp1251':                         'ru_UA.CP1251',\r
+    'ru_ua.koi8u':                          'ru_UA.KOI8-U',\r
+    'ru_ua.microsoftcp1251':                'ru_UA.CP1251',\r
+    'rumanian':                             'ro_RO.ISO8859-2',\r
+    'russian':                              'ru_RU.ISO8859-5',\r
+    'rw':                                   'rw_RW.ISO8859-1',\r
+    'rw_rw':                                'rw_RW.ISO8859-1',\r
+    'rw_rw.iso88591':                       'rw_RW.ISO8859-1',\r
+    'sa_in':                                'sa_IN.UTF-8',\r
+    'sat_in':                               'sat_IN.UTF-8',\r
+    'sc_it':                                'sc_IT.UTF-8',\r
+    'sd':                                   'sd_IN.UTF-8',\r
+    'sd@devanagari':                        'sd_IN.UTF-8@devanagari',\r
+    'sd_in':                                'sd_IN.UTF-8',\r
+    'sd_in@devanagari':                     'sd_IN.UTF-8@devanagari',\r
+    'sd_in@devanagari.utf8':                'sd_IN.UTF-8@devanagari',\r
+    'sd_pk':                                'sd_PK.UTF-8',\r
+    'se_no':                                'se_NO.UTF-8',\r
+    'serbocroatian':                        'sr_RS.UTF-8@latin',\r
+    'sh':                                   'sr_RS.UTF-8@latin',\r
+    'sh_ba.iso88592@bosnia':                'sr_CS.ISO8859-2',\r
+    'sh_hr':                                'sh_HR.ISO8859-2',\r
+    'sh_hr.iso88592':                       'hr_HR.ISO8859-2',\r
+    'sh_sp':                                'sr_CS.ISO8859-2',\r
+    'sh_yu':                                'sr_RS.UTF-8@latin',\r
+    'shs_ca':                               'shs_CA.UTF-8',\r
+    'si':                                   'si_LK.UTF-8',\r
+    'si_lk':                                'si_LK.UTF-8',\r
+    'sid_et':                               'sid_ET.UTF-8',\r
+    'sinhala':                              'si_LK.UTF-8',\r
+    'sk':                                   'sk_SK.ISO8859-2',\r
+    'sk_sk':                                'sk_SK.ISO8859-2',\r
+    'sk_sk.iso88592':                       'sk_SK.ISO8859-2',\r
+    'sl':                                   'sl_SI.ISO8859-2',\r
+    'sl_cs':                                'sl_CS.ISO8859-2',\r
+    'sl_si':                                'sl_SI.ISO8859-2',\r
+    'sl_si.iso88592':                       'sl_SI.ISO8859-2',\r
+    'slovak':                               'sk_SK.ISO8859-2',\r
+    'slovene':                              'sl_SI.ISO8859-2',\r
+    'slovenian':                            'sl_SI.ISO8859-2',\r
+    'so_dj':                                'so_DJ.ISO8859-1',\r
+    'so_et':                                'so_ET.UTF-8',\r
+    'so_ke':                                'so_KE.ISO8859-1',\r
+    'so_so':                                'so_SO.ISO8859-1',\r
+    'sp':                                   'sr_CS.ISO8859-5',\r
+    'sp_yu':                                'sr_CS.ISO8859-5',\r
+    'spanish':                              'es_ES.ISO8859-1',\r
+    'spanish.iso88591':                     'es_ES.ISO8859-1',\r
+    'spanish_spain':                        'es_ES.ISO8859-1',\r
+    'spanish_spain.8859':                   'es_ES.ISO8859-1',\r
+    'sq':                                   'sq_AL.ISO8859-2',\r
+    'sq_al':                                'sq_AL.ISO8859-2',\r
+    'sq_al.iso88592':                       'sq_AL.ISO8859-2',\r
+    'sq_mk':                                'sq_MK.UTF-8',\r
+    'sr':                                   'sr_RS.UTF-8',\r
+    'sr@cyrillic':                          'sr_RS.UTF-8',\r
+    'sr@latin':                             'sr_RS.UTF-8@latin',\r
+    'sr@latn':                              'sr_CS.UTF-8@latin',\r
+    'sr_cs':                                'sr_CS.UTF-8',\r
+    'sr_cs.iso88592':                       'sr_CS.ISO8859-2',\r
+    'sr_cs.iso88592@latn':                  'sr_CS.ISO8859-2',\r
+    'sr_cs.iso88595':                       'sr_CS.ISO8859-5',\r
+    'sr_cs.utf8@latn':                      'sr_CS.UTF-8@latin',\r
+    'sr_cs@latn':                           'sr_CS.UTF-8@latin',\r
+    'sr_me':                                'sr_ME.UTF-8',\r
+    'sr_rs':                                'sr_RS.UTF-8',\r
+    'sr_rs@latin':                          'sr_RS.UTF-8@latin',\r
+    'sr_rs@latn':                           'sr_RS.UTF-8@latin',\r
+    'sr_sp':                                'sr_CS.ISO8859-2',\r
+    'sr_yu':                                'sr_RS.UTF-8@latin',\r
+    'sr_yu.cp1251@cyrillic':                'sr_CS.CP1251',\r
+    'sr_yu.iso88592':                       'sr_CS.ISO8859-2',\r
+    'sr_yu.iso88595':                       'sr_CS.ISO8859-5',\r
+    'sr_yu.iso88595@cyrillic':              'sr_CS.ISO8859-5',\r
+    'sr_yu.microsoftcp1251@cyrillic':       'sr_CS.CP1251',\r
+    'sr_yu.utf8':                           'sr_RS.UTF-8',\r
+    'sr_yu.utf8@cyrillic':                  'sr_RS.UTF-8',\r
+    'sr_yu@cyrillic':                       'sr_RS.UTF-8',\r
+    'ss':                                   'ss_ZA.ISO8859-1',\r
+    'ss_za':                                'ss_ZA.ISO8859-1',\r
+    'ss_za.iso88591':                       'ss_ZA.ISO8859-1',\r
+    'st':                                   'st_ZA.ISO8859-1',\r
+    'st_za':                                'st_ZA.ISO8859-1',\r
+    'st_za.iso88591':                       'st_ZA.ISO8859-1',\r
+    'sv':                                   'sv_SE.ISO8859-1',\r
+    'sv.iso885915':                         'sv_SE.ISO8859-15',\r
+    'sv_fi':                                'sv_FI.ISO8859-1',\r
+    'sv_fi.iso88591':                       'sv_FI.ISO8859-1',\r
+    'sv_fi.iso885915':                      'sv_FI.ISO8859-15',\r
+    'sv_fi.iso885915@euro':                 'sv_FI.ISO8859-15',\r
+    'sv_fi.utf8@euro':                      'sv_FI.UTF-8',\r
+    'sv_fi@euro':                           'sv_FI.ISO8859-15',\r
+    'sv_se':                                'sv_SE.ISO8859-1',\r
+    'sv_se.88591':                          'sv_SE.ISO8859-1',\r
+    'sv_se.iso88591':                       'sv_SE.ISO8859-1',\r
+    'sv_se.iso885915':                      'sv_SE.ISO8859-15',\r
+    'sv_se@euro':                           'sv_SE.ISO8859-15',\r
+    'sw_ke':                                'sw_KE.UTF-8',\r
+    'sw_tz':                                'sw_TZ.UTF-8',\r
+    'swedish':                              'sv_SE.ISO8859-1',\r
+    'swedish.iso88591':                     'sv_SE.ISO8859-1',\r
+    'szl_pl':                               'szl_PL.UTF-8',\r
+    'ta':                                   'ta_IN.TSCII-0',\r
+    'ta_in':                                'ta_IN.TSCII-0',\r
+    'ta_in.tscii':                          'ta_IN.TSCII-0',\r
+    'ta_in.tscii0':                         'ta_IN.TSCII-0',\r
+    'ta_lk':                                'ta_LK.UTF-8',\r
+    'te':                                   'te_IN.UTF-8',\r
+    'te_in':                                'te_IN.UTF-8',\r
+    'tg':                                   'tg_TJ.KOI8-C',\r
+    'tg_tj':                                'tg_TJ.KOI8-C',\r
+    'tg_tj.koi8c':                          'tg_TJ.KOI8-C',\r
+    'th':                                   'th_TH.ISO8859-11',\r
+    'th_th':                                'th_TH.ISO8859-11',\r
+    'th_th.iso885911':                      'th_TH.ISO8859-11',\r
+    'th_th.tactis':                         'th_TH.TIS620',\r
+    'th_th.tis620':                         'th_TH.TIS620',\r
+    'thai':                                 'th_TH.ISO8859-11',\r
+    'ti_er':                                'ti_ER.UTF-8',\r
+    'ti_et':                                'ti_ET.UTF-8',\r
+    'tig_er':                               'tig_ER.UTF-8',\r
+    'tk_tm':                                'tk_TM.UTF-8',\r
+    'tl':                                   'tl_PH.ISO8859-1',\r
+    'tl_ph':                                'tl_PH.ISO8859-1',\r
+    'tl_ph.iso88591':                       'tl_PH.ISO8859-1',\r
+    'tn':                                   'tn_ZA.ISO8859-15',\r
+    'tn_za':                                'tn_ZA.ISO8859-15',\r
+    'tn_za.iso885915':                      'tn_ZA.ISO8859-15',\r
+    'tr':                                   'tr_TR.ISO8859-9',\r
+    'tr_cy':                                'tr_CY.ISO8859-9',\r
+    'tr_tr':                                'tr_TR.ISO8859-9',\r
+    'tr_tr.iso88599':                       'tr_TR.ISO8859-9',\r
+    'ts':                                   'ts_ZA.ISO8859-1',\r
+    'ts_za':                                'ts_ZA.ISO8859-1',\r
+    'ts_za.iso88591':                       'ts_ZA.ISO8859-1',\r
+    'tt':                                   'tt_RU.TATAR-CYR',\r
+    'tt_ru':                                'tt_RU.TATAR-CYR',\r
+    'tt_ru.koi8c':                          'tt_RU.KOI8-C',\r
+    'tt_ru.tatarcyr':                       'tt_RU.TATAR-CYR',\r
+    'tt_ru@iqtelif':                        'tt_RU.UTF-8@iqtelif',\r
+    'turkish':                              'tr_TR.ISO8859-9',\r
+    'turkish.iso88599':                     'tr_TR.ISO8859-9',\r
+    'ug_cn':                                'ug_CN.UTF-8',\r
+    'uk':                                   'uk_UA.KOI8-U',\r
+    'uk_ua':                                'uk_UA.KOI8-U',\r
+    'uk_ua.cp1251':                         'uk_UA.CP1251',\r
+    'uk_ua.iso88595':                       'uk_UA.ISO8859-5',\r
+    'uk_ua.koi8u':                          'uk_UA.KOI8-U',\r
+    'uk_ua.microsoftcp1251':                'uk_UA.CP1251',\r
+    'univ':                                 'en_US.utf',\r
+    'universal':                            'en_US.utf',\r
+    'universal.utf8@ucs4':                  'en_US.UTF-8',\r
+    'unm_us':                               'unm_US.UTF-8',\r
+    'ur':                                   'ur_PK.CP1256',\r
+    'ur_in':                                'ur_IN.UTF-8',\r
+    'ur_pk':                                'ur_PK.CP1256',\r
+    'ur_pk.cp1256':                         'ur_PK.CP1256',\r
+    'ur_pk.microsoftcp1256':                'ur_PK.CP1256',\r
+    'uz':                                   'uz_UZ.UTF-8',\r
+    'uz_uz':                                'uz_UZ.UTF-8',\r
+    'uz_uz.iso88591':                       'uz_UZ.ISO8859-1',\r
+    'uz_uz.utf8@cyrillic':                  'uz_UZ.UTF-8',\r
+    'uz_uz@cyrillic':                       'uz_UZ.UTF-8',\r
+    've':                                   've_ZA.UTF-8',\r
+    've_za':                                've_ZA.UTF-8',\r
+    'vi':                                   'vi_VN.TCVN',\r
+    'vi_vn':                                'vi_VN.TCVN',\r
+    'vi_vn.tcvn':                           'vi_VN.TCVN',\r
+    'vi_vn.tcvn5712':                       'vi_VN.TCVN',\r
+    'vi_vn.viscii':                         'vi_VN.VISCII',\r
+    'vi_vn.viscii111':                      'vi_VN.VISCII',\r
+    'wa':                                   'wa_BE.ISO8859-1',\r
+    'wa_be':                                'wa_BE.ISO8859-1',\r
+    'wa_be.iso88591':                       'wa_BE.ISO8859-1',\r
+    'wa_be.iso885915':                      'wa_BE.ISO8859-15',\r
+    'wa_be.iso885915@euro':                 'wa_BE.ISO8859-15',\r
+    'wa_be@euro':                           'wa_BE.ISO8859-15',\r
+    'wae_ch':                               'wae_CH.UTF-8',\r
+    'wal_et':                               'wal_ET.UTF-8',\r
+    'wo_sn':                                'wo_SN.UTF-8',\r
+    'xh':                                   'xh_ZA.ISO8859-1',\r
+    'xh_za':                                'xh_ZA.ISO8859-1',\r
+    'xh_za.iso88591':                       'xh_ZA.ISO8859-1',\r
+    'yi':                                   'yi_US.CP1255',\r
+    'yi_us':                                'yi_US.CP1255',\r
+    'yi_us.cp1255':                         'yi_US.CP1255',\r
+    'yi_us.microsoftcp1255':                'yi_US.CP1255',\r
+    'yo_ng':                                'yo_NG.UTF-8',\r
+    'yue_hk':                               'yue_HK.UTF-8',\r
+    'zh':                                   'zh_CN.eucCN',\r
+    'zh_cn':                                'zh_CN.gb2312',\r
+    'zh_cn.big5':                           'zh_TW.big5',\r
+    'zh_cn.euc':                            'zh_CN.eucCN',\r
+    'zh_cn.gb18030':                        'zh_CN.gb18030',\r
+    'zh_cn.gb2312':                         'zh_CN.gb2312',\r
+    'zh_cn.gbk':                            'zh_CN.gbk',\r
+    'zh_hk':                                'zh_HK.big5hkscs',\r
+    'zh_hk.big5':                           'zh_HK.big5',\r
+    'zh_hk.big5hk':                         'zh_HK.big5hkscs',\r
+    'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',\r
+    'zh_sg':                                'zh_SG.GB2312',\r
+    'zh_sg.gbk':                            'zh_SG.GBK',\r
+    'zh_tw':                                'zh_TW.big5',\r
+    'zh_tw.big5':                           'zh_TW.big5',\r
+    'zh_tw.euc':                            'zh_TW.eucTW',\r
+    'zh_tw.euctw':                          'zh_TW.eucTW',\r
+    'zu':                                   'zu_ZA.ISO8859-1',\r
+    'zu_za':                                'zu_ZA.ISO8859-1',\r
+    'zu_za.iso88591':                       'zu_ZA.ISO8859-1',\r
+}\r
+\r
+#\r
+# This maps Windows language identifiers to locale strings.\r
+#\r
+# This list has been updated from\r
+# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp\r
+# to include every locale up to Windows Vista.\r
+#\r
+# NOTE: this mapping is incomplete.  If your language is missing, please\r
+# submit a bug report to the Python bug tracker at http://bugs.python.org/\r
+# Make sure you include the missing language identifier and the suggested\r
+# locale code.\r
+#\r
+\r
+windows_locale = {\r
+    0x0436: "af_ZA", # Afrikaans\r
+    0x041c: "sq_AL", # Albanian\r
+    0x0484: "gsw_FR",# Alsatian - France\r
+    0x045e: "am_ET", # Amharic - Ethiopia\r
+    0x0401: "ar_SA", # Arabic - Saudi Arabia\r
+    0x0801: "ar_IQ", # Arabic - Iraq\r
+    0x0c01: "ar_EG", # Arabic - Egypt\r
+    0x1001: "ar_LY", # Arabic - Libya\r
+    0x1401: "ar_DZ", # Arabic - Algeria\r
+    0x1801: "ar_MA", # Arabic - Morocco\r
+    0x1c01: "ar_TN", # Arabic - Tunisia\r
+    0x2001: "ar_OM", # Arabic - Oman\r
+    0x2401: "ar_YE", # Arabic - Yemen\r
+    0x2801: "ar_SY", # Arabic - Syria\r
+    0x2c01: "ar_JO", # Arabic - Jordan\r
+    0x3001: "ar_LB", # Arabic - Lebanon\r
+    0x3401: "ar_KW", # Arabic - Kuwait\r
+    0x3801: "ar_AE", # Arabic - United Arab Emirates\r
+    0x3c01: "ar_BH", # Arabic - Bahrain\r
+    0x4001: "ar_QA", # Arabic - Qatar\r
+    0x042b: "hy_AM", # Armenian\r
+    0x044d: "as_IN", # Assamese - India\r
+    0x042c: "az_AZ", # Azeri - Latin\r
+    0x082c: "az_AZ", # Azeri - Cyrillic\r
+    0x046d: "ba_RU", # Bashkir\r
+    0x042d: "eu_ES", # Basque - Russia\r
+    0x0423: "be_BY", # Belarusian\r
+    0x0445: "bn_IN", # Begali\r
+    0x201a: "bs_BA", # Bosnian - Cyrillic\r
+    0x141a: "bs_BA", # Bosnian - Latin\r
+    0x047e: "br_FR", # Breton - France\r
+    0x0402: "bg_BG", # Bulgarian\r
+#    0x0455: "my_MM", # Burmese - Not supported\r
+    0x0403: "ca_ES", # Catalan\r
+    0x0004: "zh_CHS",# Chinese - Simplified\r
+    0x0404: "zh_TW", # Chinese - Taiwan\r
+    0x0804: "zh_CN", # Chinese - PRC\r
+    0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.\r
+    0x1004: "zh_SG", # Chinese - Singapore\r
+    0x1404: "zh_MO", # Chinese - Macao S.A.R.\r
+    0x7c04: "zh_CHT",# Chinese - Traditional\r
+    0x0483: "co_FR", # Corsican - France\r
+    0x041a: "hr_HR", # Croatian\r
+    0x101a: "hr_BA", # Croatian - Bosnia\r
+    0x0405: "cs_CZ", # Czech\r
+    0x0406: "da_DK", # Danish\r
+    0x048c: "gbz_AF",# Dari - Afghanistan\r
+    0x0465: "div_MV",# Divehi - Maldives\r
+    0x0413: "nl_NL", # Dutch - The Netherlands\r
+    0x0813: "nl_BE", # Dutch - Belgium\r
+    0x0409: "en_US", # English - United States\r
+    0x0809: "en_GB", # English - United Kingdom\r
+    0x0c09: "en_AU", # English - Australia\r
+    0x1009: "en_CA", # English - Canada\r
+    0x1409: "en_NZ", # English - New Zealand\r
+    0x1809: "en_IE", # English - Ireland\r
+    0x1c09: "en_ZA", # English - South Africa\r
+    0x2009: "en_JA", # English - Jamaica\r
+    0x2409: "en_CB", # English - Carribbean\r
+    0x2809: "en_BZ", # English - Belize\r
+    0x2c09: "en_TT", # English - Trinidad\r
+    0x3009: "en_ZW", # English - Zimbabwe\r
+    0x3409: "en_PH", # English - Philippines\r
+    0x4009: "en_IN", # English - India\r
+    0x4409: "en_MY", # English - Malaysia\r
+    0x4809: "en_IN", # English - Singapore\r
+    0x0425: "et_EE", # Estonian\r
+    0x0438: "fo_FO", # Faroese\r
+    0x0464: "fil_PH",# Filipino\r
+    0x040b: "fi_FI", # Finnish\r
+    0x040c: "fr_FR", # French - France\r
+    0x080c: "fr_BE", # French - Belgium\r
+    0x0c0c: "fr_CA", # French - Canada\r
+    0x100c: "fr_CH", # French - Switzerland\r
+    0x140c: "fr_LU", # French - Luxembourg\r
+    0x180c: "fr_MC", # French - Monaco\r
+    0x0462: "fy_NL", # Frisian - Netherlands\r
+    0x0456: "gl_ES", # Galician\r
+    0x0437: "ka_GE", # Georgian\r
+    0x0407: "de_DE", # German - Germany\r
+    0x0807: "de_CH", # German - Switzerland\r
+    0x0c07: "de_AT", # German - Austria\r
+    0x1007: "de_LU", # German - Luxembourg\r
+    0x1407: "de_LI", # German - Liechtenstein\r
+    0x0408: "el_GR", # Greek\r
+    0x046f: "kl_GL", # Greenlandic - Greenland\r
+    0x0447: "gu_IN", # Gujarati\r
+    0x0468: "ha_NG", # Hausa - Latin\r
+    0x040d: "he_IL", # Hebrew\r
+    0x0439: "hi_IN", # Hindi\r
+    0x040e: "hu_HU", # Hungarian\r
+    0x040f: "is_IS", # Icelandic\r
+    0x0421: "id_ID", # Indonesian\r
+    0x045d: "iu_CA", # Inuktitut - Syllabics\r
+    0x085d: "iu_CA", # Inuktitut - Latin\r
+    0x083c: "ga_IE", # Irish - Ireland\r
+    0x0410: "it_IT", # Italian - Italy\r
+    0x0810: "it_CH", # Italian - Switzerland\r
+    0x0411: "ja_JP", # Japanese\r
+    0x044b: "kn_IN", # Kannada - India\r
+    0x043f: "kk_KZ", # Kazakh\r
+    0x0453: "kh_KH", # Khmer - Cambodia\r
+    0x0486: "qut_GT",# K'iche - Guatemala\r
+    0x0487: "rw_RW", # Kinyarwanda - Rwanda\r
+    0x0457: "kok_IN",# Konkani\r
+    0x0412: "ko_KR", # Korean\r
+    0x0440: "ky_KG", # Kyrgyz\r
+    0x0454: "lo_LA", # Lao - Lao PDR\r
+    0x0426: "lv_LV", # Latvian\r
+    0x0427: "lt_LT", # Lithuanian\r
+    0x082e: "dsb_DE",# Lower Sorbian - Germany\r
+    0x046e: "lb_LU", # Luxembourgish\r
+    0x042f: "mk_MK", # FYROM Macedonian\r
+    0x043e: "ms_MY", # Malay - Malaysia\r
+    0x083e: "ms_BN", # Malay - Brunei Darussalam\r
+    0x044c: "ml_IN", # Malayalam - India\r
+    0x043a: "mt_MT", # Maltese\r
+    0x0481: "mi_NZ", # Maori\r
+    0x047a: "arn_CL",# Mapudungun\r
+    0x044e: "mr_IN", # Marathi\r
+    0x047c: "moh_CA",# Mohawk - Canada\r
+    0x0450: "mn_MN", # Mongolian - Cyrillic\r
+    0x0850: "mn_CN", # Mongolian - PRC\r
+    0x0461: "ne_NP", # Nepali\r
+    0x0414: "nb_NO", # Norwegian - Bokmal\r
+    0x0814: "nn_NO", # Norwegian - Nynorsk\r
+    0x0482: "oc_FR", # Occitan - France\r
+    0x0448: "or_IN", # Oriya - India\r
+    0x0463: "ps_AF", # Pashto - Afghanistan\r
+    0x0429: "fa_IR", # Persian\r
+    0x0415: "pl_PL", # Polish\r
+    0x0416: "pt_BR", # Portuguese - Brazil\r
+    0x0816: "pt_PT", # Portuguese - Portugal\r
+    0x0446: "pa_IN", # Punjabi\r
+    0x046b: "quz_BO",# Quechua (Bolivia)\r
+    0x086b: "quz_EC",# Quechua (Ecuador)\r
+    0x0c6b: "quz_PE",# Quechua (Peru)\r
+    0x0418: "ro_RO", # Romanian - Romania\r
+    0x0417: "rm_CH", # Romansh\r
+    0x0419: "ru_RU", # Russian\r
+    0x243b: "smn_FI",# Sami Finland\r
+    0x103b: "smj_NO",# Sami Norway\r
+    0x143b: "smj_SE",# Sami Sweden\r
+    0x043b: "se_NO", # Sami Northern Norway\r
+    0x083b: "se_SE", # Sami Northern Sweden\r
+    0x0c3b: "se_FI", # Sami Northern Finland\r
+    0x203b: "sms_FI",# Sami Skolt\r
+    0x183b: "sma_NO",# Sami Southern Norway\r
+    0x1c3b: "sma_SE",# Sami Southern Sweden\r
+    0x044f: "sa_IN", # Sanskrit\r
+    0x0c1a: "sr_SP", # Serbian - Cyrillic\r
+    0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic\r
+    0x081a: "sr_SP", # Serbian - Latin\r
+    0x181a: "sr_BA", # Serbian - Bosnia Latin\r
+    0x045b: "si_LK", # Sinhala - Sri Lanka\r
+    0x046c: "ns_ZA", # Northern Sotho\r
+    0x0432: "tn_ZA", # Setswana - Southern Africa\r
+    0x041b: "sk_SK", # Slovak\r
+    0x0424: "sl_SI", # Slovenian\r
+    0x040a: "es_ES", # Spanish - Spain\r
+    0x080a: "es_MX", # Spanish - Mexico\r
+    0x0c0a: "es_ES", # Spanish - Spain (Modern)\r
+    0x100a: "es_GT", # Spanish - Guatemala\r
+    0x140a: "es_CR", # Spanish - Costa Rica\r
+    0x180a: "es_PA", # Spanish - Panama\r
+    0x1c0a: "es_DO", # Spanish - Dominican Republic\r
+    0x200a: "es_VE", # Spanish - Venezuela\r
+    0x240a: "es_CO", # Spanish - Colombia\r
+    0x280a: "es_PE", # Spanish - Peru\r
+    0x2c0a: "es_AR", # Spanish - Argentina\r
+    0x300a: "es_EC", # Spanish - Ecuador\r
+    0x340a: "es_CL", # Spanish - Chile\r
+    0x380a: "es_UR", # Spanish - Uruguay\r
+    0x3c0a: "es_PY", # Spanish - Paraguay\r
+    0x400a: "es_BO", # Spanish - Bolivia\r
+    0x440a: "es_SV", # Spanish - El Salvador\r
+    0x480a: "es_HN", # Spanish - Honduras\r
+    0x4c0a: "es_NI", # Spanish - Nicaragua\r
+    0x500a: "es_PR", # Spanish - Puerto Rico\r
+    0x540a: "es_US", # Spanish - United States\r
+#    0x0430: "", # Sutu - Not supported\r
+    0x0441: "sw_KE", # Swahili\r
+    0x041d: "sv_SE", # Swedish - Sweden\r
+    0x081d: "sv_FI", # Swedish - Finland\r
+    0x045a: "syr_SY",# Syriac\r
+    0x0428: "tg_TJ", # Tajik - Cyrillic\r
+    0x085f: "tmz_DZ",# Tamazight - Latin\r
+    0x0449: "ta_IN", # Tamil\r
+    0x0444: "tt_RU", # Tatar\r
+    0x044a: "te_IN", # Telugu\r
+    0x041e: "th_TH", # Thai\r
+    0x0851: "bo_BT", # Tibetan - Bhutan\r
+    0x0451: "bo_CN", # Tibetan - PRC\r
+    0x041f: "tr_TR", # Turkish\r
+    0x0442: "tk_TM", # Turkmen - Cyrillic\r
+    0x0480: "ug_CN", # Uighur - Arabic\r
+    0x0422: "uk_UA", # Ukrainian\r
+    0x042e: "wen_DE",# Upper Sorbian - Germany\r
+    0x0420: "ur_PK", # Urdu\r
+    0x0820: "ur_IN", # Urdu - India\r
+    0x0443: "uz_UZ", # Uzbek - Latin\r
+    0x0843: "uz_UZ", # Uzbek - Cyrillic\r
+    0x042a: "vi_VN", # Vietnamese\r
+    0x0452: "cy_GB", # Welsh\r
+    0x0488: "wo_SN", # Wolof - Senegal\r
+    0x0434: "xh_ZA", # Xhosa - South Africa\r
+    0x0485: "sah_RU",# Yakut - Cyrillic\r
+    0x0478: "ii_CN", # Yi - PRC\r
+    0x046a: "yo_NG", # Yoruba - Nigeria\r
+    0x0435: "zu_ZA", # Zulu\r
+}\r
+\r
+def _print_locale():\r
+\r
+    """ Test function.\r
+    """\r
+    categories = {}\r
+    def _init_categories(categories=categories):\r
+        for k,v in globals().items():\r
+            if k[:3] == 'LC_':\r
+                categories[k] = v\r
+    _init_categories()\r
+    del categories['LC_ALL']\r
+\r
+    print 'Locale defaults as determined by getdefaultlocale():'\r
+    print '-'*72\r
+    lang, enc = getdefaultlocale()\r
+    print 'Language: ', lang or '(undefined)'\r
+    print 'Encoding: ', enc or '(undefined)'\r
+    print\r
+\r
+    print 'Locale settings on startup:'\r
+    print '-'*72\r
+    for name,category in categories.items():\r
+        print name, '...'\r
+        lang, enc = getlocale(category)\r
+        print '   Language: ', lang or '(undefined)'\r
+        print '   Encoding: ', enc or '(undefined)'\r
+        print\r
+\r
+    print\r
+    print 'Locale settings after calling resetlocale():'\r
+    print '-'*72\r
+    resetlocale()\r
+    for name,category in categories.items():\r
+        print name, '...'\r
+        lang, enc = getlocale(category)\r
+        print '   Language: ', lang or '(undefined)'\r
+        print '   Encoding: ', enc or '(undefined)'\r
+        print\r
+\r
+    try:\r
+        setlocale(LC_ALL, "")\r
+    except:\r
+        print 'NOTE:'\r
+        print 'setlocale(LC_ALL, "") does not support the default locale'\r
+        print 'given in the OS environment variables.'\r
+    else:\r
+        print\r
+        print 'Locale settings after calling setlocale(LC_ALL, ""):'\r
+        print '-'*72\r
+        for name,category in categories.items():\r
+            print name, '...'\r
+            lang, enc = getlocale(category)\r
+            print '   Language: ', lang or '(undefined)'\r
+            print '   Encoding: ', enc or '(undefined)'\r
+            print\r
+\r
+###\r
+\r
+try:\r
+    LC_MESSAGES\r
+except NameError:\r
+    pass\r
+else:\r
+    __all__.append("LC_MESSAGES")\r
+\r
+if __name__=='__main__':\r
+    print 'Locale aliasing:'\r
+    print\r
+    _print_locale()\r
+    print\r
+    print 'Number formatting:'\r
+    print\r
+    _test()\r