From 8fcca1d3e665ea1626a476d925c506ec4ee1d4b6 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Fri, 18 Mar 2022 15:02:09 -0500 Subject: [PATCH 1/3] PEP 686: Update links & PEP refs to follow modern guidance in PEP 12 --- pep-0686.rst | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/pep-0686.rst b/pep-0686.rst index a53d994b1ae..de4f3a3166d 100644 --- a/pep-0686.rst +++ b/pep-0686.rst @@ -11,7 +11,7 @@ Python-Version: 3.12 Abstract ======== -This PEP proposes making UTF-8 mode [1]_ on by default. +This PEP proposes making :pep:`UTF-8 mode <540>` on by default. With this change, Python uses UTF-8 for default encoding of files, stdio, and pipes consistently. @@ -86,19 +86,21 @@ To resolve this backward incompatibility, users can do: * Disable UTF-8 mode * Use ``EncodingWarning`` to find where the default encoding is used and use - ``encoding="locale"`` option to keep using locale encoding. [2]_ + ``encoding="locale"`` option to keep using locale encoding + (as defined in :pep:`597`). Preceding examples ================== -* Ruby changed the default ``external_encoding`` to UTF-8 on Windows in Ruby - 3.0 (2020). [3]_ -* Java changed the default text encoding to UTF-8 in JDK 18. (2022). [4]_ +* Ruby `changed `__ the default ``external_encoding`` + to UTF-8 on Windows in Ruby 3.0 (2020). +* Java `changed `__ the default text encoding + to UTF-8 in JDK 18. (2022). Both Ruby and Java have an option for backward compatibility. -They don't provide any warning like ``EncodingWarning`` [2]_ in Python for use -of the default encoding. +They don't provide any warning like :pep:`597`'s ``EncodingWarning`` +in Python for use of the default encoding. Rejected Alternative @@ -114,7 +116,7 @@ ASCII. And some users use Python only on Unix with UTF-8 locale. So forcing users to specify the ``encoding`` option everywhere is too painful. -Java also rejected this idea [4]_. +Java also rejected this idea in `JEP 400`_. How to teach this @@ -128,24 +130,12 @@ non-UTF-8 text files. For existing users, see `Backward compatibility`_ section. -Resources -========= - -.. [1] `PEP 540 – Add a new UTF-8 Mode`__ - - __ https://peps.python.org/pep-0540/ - -.. [2] `PEP 597 – Add optional EncodingWarning`__ - - __ https://peps.python.org/pep-0597/ - -.. [3] `Set default for Encoding.default_external to UTF-8 on Windows`__ - - __ https://bugs.ruby-lang.org/issues/16604 +References +========== -.. [4] `JEP 400: UTF-8 by Default`__ +.. _Feature #16604: https://bugs.ruby-lang.org/issues/16604 - __ https://openjdk.java.net/jeps/400 +.. _JEP 400: https://openjdk.java.net/jeps/400 Copyright From 824b14d4fd469193a10f626e7ff216e0693f34f6 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Fri, 18 Mar 2022 15:04:01 -0500 Subject: [PATCH 2/3] PEP 686: Add Discussions-To link --- pep-0686.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pep-0686.rst b/pep-0686.rst index de4f3a3166d..0978770670f 100644 --- a/pep-0686.rst +++ b/pep-0686.rst @@ -1,11 +1,13 @@ PEP: 686 Title: Make UTF-8 mode default Author: Inada Naoki +Discussions-To: https://discuss.python.org/t/14435 Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 18-Mar-2022 Python-Version: 3.12 +Post-History: `18-Mar-2022 `__ Abstract From 39fd46b0fa5838a4979e591d8662e41738591fd1 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Fri, 18 Mar 2022 15:08:41 -0500 Subject: [PATCH 3/3] PEP 686: Add PEP author to CODEOWNERS --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5b250f39244..3b0af8c4be3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -565,6 +565,7 @@ pep-0683.rst @ericsnowcurrently pep-0684.rst @ericsnowcurrently # pep-0684.rst pep-0685.rst @brettcannon +pep-0686.rst @methane # ... # pep-0754.txt # ...