Gordon Messmer <gordon.mess...@gmail.com> added the comment:

As an example, let's consider dnf's i18n setup:

    try:
        dnf.pycomp.setlocale(locale.LC_ALL, '')
    except locale.Error:
        # default to C.UTF-8 or C locale if we got a failure.
        try:
            dnf.pycomp.setlocale(locale.LC_ALL, 'C.UTF-8')
            os.environ['LC_ALL'] = 'C.UTF-8'
        except locale.Error:
            dnf.pycomp.setlocale(locale.LC_ALL, 'C')
            os.environ['LC_ALL'] = 'C'

If setting the environment-specified locale fails, dnf will attempt to set the 
locale
to C.UTF-8, and if that fails it will set the locale to C.  This seems like an 
ideal
process.  If the expected locale is missing, dnf will attempt to at least use 
UTF-8,
before falling back to the C locale.

Unfortunately, because of the alias, this process will be unable to set the 
'C.UTF-8'
locale on systems which do not have the 'en_US' locale installed.  This renders
system support for 'C.UTF-8' unusable when no locales are installed.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30755>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to