[Python-Dev] PEP 540: Add a new UTF-8 mode (v3) (original) (raw)
INADA Naoki songofacandy at gmail.com
Sun Dec 10 12:46:35 EST 2017
- Previous message (by thread): [Python-Dev] PEP 540: Add a new UTF-8 mode (v3)
- Next message (by thread): [Python-Dev] PEP 540: Add a new UTF-8 mode (v3)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Except one typo I commented on Github, I accept PEP 540.
Well done, Victor and Nick for PEP 540 and 538. Python 3.7 will be most UTF-8 friendly Python 3 than ever.
INADA Naoki <songofacandy at gmail.com>
On Mon, Dec 11, 2017 at 2:21 AM, Victor Stinner <victor.stinner at gmail.com> wrote:
Ok, I fixed the effects of the locale coercion (PEP 538). Does it now look good to you, Naoki?
https://www.python.org/dev/peps/pep-0540/#relationship-with-the-locale-coercion-pep-538 The commit: https://github.com/python/peps/commit/71cda51fbb622ece63f7a9d3c8fa6cd33ce06b58 diff --git a/pep-0540.txt b/pep-0540.txt index 0a9cbc1e..c163916d 100644 --- a/pep-0540.txt +++ b/pep-0540.txt @@ -144,9 +144,15 @@ The POSIX locale enables the locale coercion (PEP 538) and the UTF-8 mode (PEP 540). When the locale coercion is enabled, enabling the UTF-8 mode has no (additional) effect. -Locale coercion only impacts non-Python code like C libraries, whereas -the Python UTF-8 Mode only impacts Python code: the two PEPs are -complementary. +The UTF-8 has the same effect than locale coercion: +
sys.getfilesystemencoding()
returns'UTF-8'
, +locale.getpreferredencoding()
returnsUTF-8
,sys.stdin
and +sys.stdout
error handler set tosurrogateescape
. These changes +only affect Python code. But the locale coercion has addiditonal +effects: theLCCTYPE
environment variable and theLCCTYPE
+locale are set to a UTF-8 locale likeC.UTF-8
. The side effect is +that non-Python code is also impacted by the locale coercion. The two +PEPs are complementary. On platforms where locale coercion is not supported like Centos 7, the POSIX locale only enables the UTF-8 Mode. In this case, Python code uses Victor2017-12-10 5:47 GMT+01:00 INADA Naoki <songofacandy at gmail.com>: Now I'm OK to accept the PEP, except one nitpick.
Locale coercion only impacts non-Python code like C libraries, whereas the Python UTF-8 Mode only impacts Python code: the two PEPs are complementary. This sentence seems bit misleading. If UTF-8 mode is disabled explicitly, locale coercion affects Python code too. locale.getpreferredencoding() is UTF-8, open()' s default encoding is UTF-8, and stdio is UTF-8/surrogateescape. So shouldn't this sentence is: "Locale coercion impacts both of Python code and non-Python code like C libraries, whereas ..."? INADA Naoki <songofacandy at gmail.com>
- Previous message (by thread): [Python-Dev] PEP 540: Add a new UTF-8 mode (v3)
- Next message (by thread): [Python-Dev] PEP 540: Add a new UTF-8 mode (v3)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]