summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2022-04-04 02:46:57 (GMT)
committerGitHub <noreply@github.com>2022-04-04 02:46:57 (GMT)
commit4216dce04b7d3f329beaaafc82a77c4ac6cf4d57 (patch)
treeb3ff3df025ddb3c383beb156fd150df62d40ac8e /Doc/library/io.rst
parent6db2db91b96aaa1270c200ec931a2250fe2799c7 (diff)
downloadcpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.zip
cpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.tar.gz
cpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.tar.bz2
bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index d512334..80107d5 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -198,12 +198,13 @@ High-level Module Interface
This is a helper function for callables that use :func:`open` or
:class:`TextIOWrapper` and have an ``encoding=None`` parameter.
- This function returns *encoding* if it is not ``None`` and ``"locale"`` if
- *encoding* is ``None``.
+ This function returns *encoding* if it is not ``None``.
+ Otherwise, it returns ``"locale"`` or ``"utf-8"`` depending on
+ :ref:`UTF-8 Mode <utf8-mode>`.
This function emits an :class:`EncodingWarning` if
:data:`sys.flags.warn_default_encoding <sys.flags>` is true and *encoding*
- is None. *stacklevel* specifies where the warning is emitted.
+ is ``None``. *stacklevel* specifies where the warning is emitted.
For example::
def read_text(path, encoding=None):
@@ -218,6 +219,10 @@ High-level Module Interface
.. versionadded:: 3.10
+ .. versionchanged:: 3.11
+ :func:`text_encoding` returns "utf-8" when UTF-8 mode is enabled and
+ *encoding* is ``None``.
+
.. exception:: BlockingIOError