STINNER Victor <vstin...@python.org> added the comment:

> 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().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47000>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to