Skip to content

Commit ff066b1

Browse files
committed
Improve What's New entry
1 parent f095ab0 commit ff066b1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,24 @@ New features
7575
Other language changes
7676
======================
7777

78-
* Python UTF-8 mode is now enabled by default.
79-
It may be disabled with by setting :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` as
80-
an environment variable or by using the :option:`-X utf8=0 <-X>` flag.
81-
See :pep:`686` for further details.
78+
* Python now uses UTF-8 as the default encoding, independent of the system's
79+
environment. This means that I/O operations without an explicit encoding,
80+
e.g. ``open('flying-circus.txt')``, will use UTF-8.
8281

82+
This only applies when no ``encoding`` argument is given. For best
83+
compatibility between versions of Python, ensure that an explicit ``encoding``
84+
argument is always provided. The :ref:`opt-in encoding warning <io-encoding-warning>`
85+
can be used to identify code that may be affected by this change.
86+
The special special ``encoding='locale'`` argument uses the current locale
87+
encoding, and has been supported since Python 3.10.
88+
89+
To retain the previous behaviour, Python's UTF-8 mode may be disabled with
90+
the :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` environment variable or the
91+
:option:`-X utf8=0 <-X>` command line option.
92+
93+
.. seealso:: :pep:`686` for further details.
94+
95+
(Contributed by Adam Turner in :gh:`133711`; PEP 686 written by Inada Naoki.)
8396

8497
New modules
8598
===========

0 commit comments

Comments
 (0)