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
Two improvements for the locale aliasing engine #57173
Comments
Hi, There appears to be some space for improvement Sometimes, one wishes to be able Judging from the Python manuals and import locale
ianaLanguageSubtag='en' # the desired national locale
locale.setlocale(locale.LC_ALL,
(ianaLanguageSubtag, locale.getpreferredencoding())) #(1)
locale.setlocale(locale.LC_ALL,
locale.normalize(ianaLanguageSubtag)) #(2) For a quicker reference, this is The locale aliasing engine binds
the IANA language subtags to POSIX locales.
Its effects can be directly observed
through locale.normalize:
>>> import locale
>>> locale.normalize('hr')
'hr_HR.ISO8859-2'
>>> locale.normalize('en')
'en_US.ISO8859-1' My first objection concerns the Windows behaviour locale.setlocale(locale.LC_ALL, 'English_United States.1252') IMHO this issue should be fixed, perhaps by providing My second objection concerns the behaviour on Linux, This might be fixed by changing the encodings Source code references: comp.lang.python discussion: Cheers, Sinisa |
I believe Martin is working on a proposal that will solve the windows issue, but it may be quite some time before that happens. Yes, the windows issue is essentially a dup, but the linux issue is different. As for your question, fixing the Windows issue is definitely an enhancement, since it requires mapping (or providing, as Martin proposes) the standard locale names on Windows, which is a service that currently doesn't exist. The linux issue might be a bug...we sometimes update alias tables in maintenance release. |
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: