Bug 1590680 - Unsupported locale C.UTF-8
Summary: Unsupported locale C.UTF-8
Keywords:
Status: CLOSED DUPLICATE of bug 1361965
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-13 08:14 UTC by Christian Heimes
Modified: 2018-06-13 08:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-13 08:23:49 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Christian Heimes 2018-06-13 08:14:50 UTC
Description of problem:
RHEL doesn't support the generic locale "C.UTF-8". Only "C" and language specific locales like "en_US.UTF-8" are supported.

The lack of "C.UTF-8" breaks IdM/IPA. IPA sets LC_ALL=C.UTF-8 in httpd.service file in order to force Python to use UTF-8 file system encoding instead of ASCII file system encoding. Without LC_CTYPE=C.UTF-8 or LC_ALL=C.UTF-8, sys.getfilesystemencoding() is ANSI_X3.4-1968 (aka ASCII), so no file names with non-ASCII chars are supported. You can find more details in https://www.python.org/dev/peps/pep-0538/

I'm opening this bug against glibc, because on Fedora the locale is provided by glibc-common:
# rpm -qf /usr/lib/locale/C.utf8/LC_CTYPE
glibc-common-2.27-15.fc28.x86_64


Version-Release number of selected component (if applicable):
glibc-common-2.17-254.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"

Actual results:
ANSI_X3.4-1968

Expected results:
UTF-8

Additional info:

On RHEL 7.5 and 7.6:
$ env -i LC_ALL=C python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=en_US.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ python -c "import locale; print locale.setlocale(locale.LC_ALL, 'C.UTF-8')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

On Fedora 27 and 28:
$ env -i LC_ALL=C python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ env -i LC_ALL=en_US.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ python -c "import locale; print locale.setlocale(locale.LC_ALL, 'C.UTF-8')"
C.UTF-8

Comment 2 Florian Weimer 2018-06-13 08:23:49 UTC

*** This bug has been marked as a duplicate of bug 1361965 ***


Note You need to log in before you can comment on or make changes to this bug.