gh-90301: Doc: Add references to PEP 686 (#96816)

Doc: Add references to PEP 686.
This commit is contained in:
Inada Naoki 2022-10-05 07:04:44 +09:00 committed by GitHub
parent 9fbfa42ece
commit 87679a6e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -123,17 +123,19 @@ encoding is not UTF-8 for most Windows users. For example::
with open("README.md") as f: with open("README.md") as f:
long_description = f.read() long_description = f.read()
Additionally, while there is no concrete plan as of yet, Python may change
the default text file encoding to UTF-8 in the future.
Accordingly, it is highly recommended that you specify the encoding Accordingly, it is highly recommended that you specify the encoding
explicitly when opening text files. If you want to use UTF-8, pass explicitly when opening text files. If you want to use UTF-8, pass
``encoding="utf-8"``. To use the current locale encoding, ``encoding="utf-8"``. To use the current locale encoding,
``encoding="locale"`` is supported in Python 3.10. ``encoding="locale"`` is supported since Python 3.10.
When you need to run existing code on Windows that attempts to open .. seealso::
UTF-8 files using the default locale encoding, you can enable the UTF-8
mode. See :ref:`UTF-8 mode on Windows <win-utf8-mode>`. :ref:`utf8-mode`
Python UTF-8 Mode can be used to change the default encoding to
UTF-8 from locale-specific encoding.
:pep:`686`
Python 3.15 will make :ref:`utf8-mode` default.
.. _io-encoding-warning: .. _io-encoding-warning:

View File

@ -159,6 +159,11 @@ can be read from :data:`sys.flags.utf8_mode <sys.flags>`.
See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>` See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>`
and the :term:`filesystem encoding and error handler`. and the :term:`filesystem encoding and error handler`.
.. seealso::
:pep:`686`
Python 3.15 will make :ref:`utf8-mode` default.
.. _os-procinfo: .. _os-procinfo: