8000 GH-133711: Enable UTF-8 mode by default (PEP 686) by AA-Turner · Pull Request #133712 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-133711: Enable UTF-8 mode by default (PEP 686) #133712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 15, 2025
Merged
Prev Previous commit
Next Next commit
Add references to UTF-8 and Unicode
  • Loading branch information
AA-Turner committed May 10, 2025
commit abfb86419453cdf837de5d5d18a17797cb3ed130
8 changes: 7 additions & 1 deletion 8 Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ New features
Other language changes
======================

* Python now uses UTF-8 as the default encoding, independent of the system's
* Python now uses UTF-8_ as the default encoding, independent of the system's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might mention the UTF-8 Mode earlier since it has other side effects documented in the UTF-8 Mode section, such as changing sys.stdout error handler and ignoring the locale encoding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"default encoding" is UTF-8 since Python 3.0. (e.g. sys.getdefaultencoding())

environment. This means that I/O operations without an explicit encoding,
e.g. ``open('flying-circus.txt')``, will use UTF-8.
UTF-8 is a widely-supported Unicode_ character encoding that has become a
*de facto* standard for representing text, including nearly every webpage
on the internet, many common file formats, programming languages, and more.

This only applies when no ``encoding`` argument is given. For best
compatibility between versions of Python, ensure that an explicit ``encoding``
Expand All @@ -92,6 +95,9 @@ Other language changes

.. seealso:: :pep:`686` for further details.

.. _UTF-8: https://en.wikipedia.org/wiki/UTF-8
.. _Unicode: https://home.unicode.org/

(Contributed by Adam Turner in :gh:`133711`; PEP 686 written by Inada Naoki.)

New modules
Expand Down
Loading
0