-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
os.device_encoding() doesn't respect the UTF-8 Mode #86402
Comments
When the UTF-8 Mode is enabled, sys.stdout.encoding is always UTF-8, whereas os.devide_encoding(sys.stdout.fileno()) returns the locale encoding. os.devide_encoding() must return UTF-8 when the UTF-8 Mode is used. |
In bpo-42208, I added C _Py_GetLocaleEncoding() function and Python _locale._get_locale_encoding() function. |
I don't think UTF-8 mode should override os.device_encoding() on Windows. UTF-8 mode can be used to ignore legacy locale encoding, and os.device_encoding() uses the locale encoding on Unix. So overriding it make sense. But locale encoding and console cp are different on Windows. Users may want to know console cp even when they want to use UTF-8 by default for reading/writing text files. |
You're right. My final change leaves Windows unchanged. |
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: