[issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8

2019-07-23 Thread Gordon Messmer


Gordon Messmer  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 
<https://bugs.python.org/issue30755>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8

2019-07-23 Thread Gordon Messmer


Change by Gordon Messmer :


--
keywords: +patch
pull_requests: +14696
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14925

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



[issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8

2019-07-09 Thread Gordon Messmer


Gordon Messmer  added the comment:

> I agree we shouldn't be aliasing C.UTF-8 to en_US.UTF-8 though

What can we do about reverting that change?  Python's current behavior causes 
unexpected exceptions, especially in containers.

I'm currently debugging test failures in a Python application that occur in 
Fedora rawhide containers.  Those containers don't have any locales installed.  
The test software saves its current locale, changes the locale in order to run 
a test, and then restores the original.  Because Python is incorrectly 
reporting the original locale as "en_US", restoring the original fails.

--

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



[issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8

2019-07-08 Thread Gordon Messmer


Gordon Messmer  added the comment:

> I can see that it might be helpful to provide such a conversion if
> C.UTF-8 doesn't exist and en_US.UTF-8 does

That can't happen.  The "C" locale describes the behavior defined in the ISO C 
standard.  It's built-in to glibc (and should be for all other libc 
implementations).  All other locales require external support (i.e. 
/usr/lib/locale/)

https://www.gnu.org/software/libc/manual/html_node/Standard-Locales.html#Standard-Locales

--
nosy: +gordonmessmer

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



[issue34138] imaplib RFC 6855 issue

2018-09-19 Thread Gordon Messmer


Gordon Messmer  added the comment:

PR 9436 should resolve the issue.

Since the RFC requires the "UTF8 (" prefix in the "data" and not in the 
literal, that had to be moved into the _command function.

This change should only affect the append() use, as that is currently the only 
function that sets self.literal to a value that is not a function.  The 
authenticate() use is not affected, and no other functions set self.literal.

--
nosy: +gordonmessmer

___
Python tracker 
<https://bugs.python.org/issue34138>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com