-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-29571: Fix test_re.test_locale_flag() #12099
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
Conversation
Use locale.getpreferredencoding() rather than locale.getlocale() to get the locale encoding. With some locales, locale.getlocale() returns the wrong encoding. For example, on Fedora 29, locale.getlocale() returns ISO-8859-1 encoding for the "en_IN" locale, whereas locale.getpreferredencoding() reports the correct encoding: UTF-8.
I tested manually the PR on Fedora 29. Without the fix:
With the fix:
|
I can confirm the issue and the PR fixes the issue. But would like to know the difference between this PR and #149 since they both seem to return the same result but #149 ended up breaking Windows and had to be reverted with #554 meanwhile current PR works with windows CI.
|
Honestly, I don't know: The two Windows CIs passed on this PR. I also tested manually the PR on my Windows VM and it passed. |
Thanks @vstinner for the PR ๐ฎ๐.. I'm working now to backport this PR to: 3.7. |
Use locale.getpreferredencoding() rather than locale.getlocale() to get the locale encoding. With some locales, locale.getlocale() returns the wrong encoding. For example, on Fedora 29, locale.getlocale() returns ISO-8859-1 encoding for the "en_IN" locale, whereas locale.getpreferredencoding() reports the correct encoding: UTF-8. (cherry picked from commit ab71f8b) Co-authored-by: Victor Stinner <[email protected]>
GH-12108 is a backport of this pull request to the 3.7 branch. |
Use locale.getpreferredencoding() rather than locale.getlocale() to
get the locale encoding. With some locales, locale.getlocale()
returns the wrong encoding.
For example, on Fedora 29, locale.getlocale() returns ISO-8859-1
encoding for the "en_IN" locale, whereas
locale.getpreferredencoding() reports the correct encoding: UTF-8.
https://bugs.python.org/issue29571