New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for systemd locale on startup if current locale is set to POSIX #65567
Comments
bpo-19977 added "surrogateescape" to the fallback settings for the standard streams if Python 3 appears to be running under the POSIX locale (which Python 3 currently reads as setting a default encoding of ASCII, which is almost certainly wrong on any modern Linux system). If a modern Linux system is using systemd as the process manager, then there will likely be a "/etc/locale.conf" file providing settings like LANG - due to problematic requirements in the POSIX specification, this file (when available) is likely to be a better "source of truth" regarding the system encoding than the environment where the interpreter process is started, at least when the latter is claiming ASCII as the default encoding. See http://www.freedesktop.org/software/systemd/man/locale.conf.html for more details. |
I don't think that Python should read such configuration file. If you consider that something is wrong here, please report the issue to the C library. |
Why is the default encoding of POSIX wrong on a modern Linux system? |
That's the problem - even on UTF-8 systems, Linux programs will often be systemd tackles that by adding the extra config file to ensure *all* the However, a fair bit of groundwork is needed to avoid any innate reliance on |
While this is still a problem I'm interested in solving, I no longer think reading the systemd locale config file would be a good way to address it. See bpo-28180 for a more recent discussion of some other alternatives. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: