Message389066
| Author |
vstinner |
| Recipients |
lemburg, vstinner |
| Date |
2021年03月19日.10:36:11 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1616150171.52.0.85428527583.issue43552@roundup.psfhosted.org> |
| In-reply-to |
| Content |
> locale.getencoding()
>
> which interfaces to nl_langinfo(CODESET) or the Windows code
> page and does not try to do any magic, ie. does *not* call
> setlocale(). It needs to return what the lib C currently
> knows and uses as encoding.
This is locale.get_current_locale_encoding(). I would like to put "current" in the name, because there is a lot of confusion between get_current_locale_encoding() encoding and locale.getpreferredencoding(False) encoding. In locale.getpreferredencoding(False), Python ignores the locale in some cases which is counter intuitive.
I propose to add new functions to reduce confusion and better document the subtle differences between the different "locale encodings".
That's also why I propose to rename the "locale encoding" to the "Python locale encoding" in the documentation: clarify the Python ignores the locale sometimes.
The PEP 538 (coerce the C locale) and PEP 540 (Python UTF-8 Mode) introduced confusion. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2021年03月19日 10:36:11 | vstinner | set | recipients:
+ vstinner, lemburg |
| 2021年03月19日 10:36:11 | vstinner | set | messageid: <1616150171.52.0.85428527583.issue43552@roundup.psfhosted.org> |
| 2021年03月19日 10:36:11 | vstinner | link | issue43552 messages |
| 2021年03月19日 10:36:11 | vstinner | create |
|