Skip to content

Commit

Permalink
PEP 686: Update URLs, PEP references, Discussions-To and CODEOWNERS p…
Browse files Browse the repository at this point in the history
…er PEP 12 (#2444)
  • Loading branch information
CAM-Gerlach authored Mar 19, 2022
1 parent f500416 commit 06a3e1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ...
Expand Down
40 changes: 16 additions & 24 deletions pep-0686.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
PEP: 686
Title: Make UTF-8 mode default
Author: Inada Naoki <songofacandy@gmail.com>
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 <https://discuss.python.org/t/14435>`__


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.
Expand Down Expand Up @@ -86,19 +88,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 <Feature #16604_>`__ the default ``external_encoding``
to UTF-8 on Windows in Ruby 3.0 (2020).
* Java `changed <JEP 400_>`__ 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
Expand All @@ -114,7 +118,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
Expand All @@ -128,24 +132,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
Expand Down

0 comments on commit 06a3e1e

Please sign in to comment.