This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, lemburg, methane, vstinner
Date 2022-03-22.13:18:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647955102.32.0.512284263183.issue47000@roundup.psfhosted.org>
In-reply-to
Content
> But some user want to use UTF-8 mode to change default encoding in their Python environments without waiting Python default encoding changed.

IMO it's a different use case and it should be a different thing. Changing encoding="locale" today is too late, since it's already shipped in Python 3.10 (PEP 597).

I proposed the "current locale" name to distinguish it from the existing "locale":

* "current locale": LC_CTYPE locale encoding or ANSI code page
* "locale": "UTF-8" in UTF-8 Mode, or the current locale

The unclear part to me is if "current locale" must change if the LC_CTYPE locale is changed, or if it should be read once at startup and then never change.

There *are* use case to really read the *current* LC_CTYPE locale encoding. There is already C API for that:

* PyUnicode_EncodeLocale()
* PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize()

See also the "current_locale" parameter of the private API _Py_EncodeLocaleEx() and _Py_DecodeLocaleEx().
History
Date User Action Args
2022-03-22 13:18:22vstinnersetrecipients: + vstinner, lemburg, ezio.melotti, methane
2022-03-22 13:18:22vstinnersetmessageid: <1647955102.32.0.512284263183.issue47000@roundup.psfhosted.org>
2022-03-22 13:18:22vstinnerlinkissue47000 messages
2022-03-22 13:18:22vstinnercreate