summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2022-04-14 07:00:35 (GMT)
committerGitHub <noreply@github.com>2022-04-14 07:00:35 (GMT)
commit13b17e2a0a56d506d62a0bf2774e3deb4cbaeb72 (patch)
tree506c197765d1aa1f14cfe51134db7088288fd83c /Doc
parent7b87e8af0cb8df0d76e8ab18a9b12affb4526103 (diff)
downloadcpython-13b17e2a0a56d506d62a0bf2774e3deb4cbaeb72.zip
cpython-13b17e2a0a56d506d62a0bf2774e3deb4cbaeb72.tar.gz
cpython-13b17e2a0a56d506d62a0bf2774e3deb4cbaeb72.tar.bz2
gh-91156: Fix `encoding="locale"` in UTF-8 mode (GH-70056)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/io.rst5
-rw-r--r--Doc/using/windows.rst2
2 files changed, 3 insertions, 4 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 80107d5..53dad99 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -112,7 +112,7 @@ Text Encoding
-------------
The default encoding of :class:`TextIOWrapper` and :func:`open` is
-locale-specific (:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>`).
+locale-specific (:func:`locale.getencoding`).
However, many developers forget to specify the encoding when opening text files
encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix
@@ -948,8 +948,7 @@ Text I/O
:class:`TextIOBase`.
*encoding* gives the name of the encoding that the stream will be decoded or
- encoded with. It defaults to
- :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>`.
+ encoded with. It defaults to :func:`locale.getencoding()`.
``encoding="locale"`` can be used to specify the current locale's encoding
explicitly. See :ref:`io-text-encoding` for more information.
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst
index 83eee28..88dcb00 100644
--- a/Doc/using/windows.rst
+++ b/Doc/using/windows.rst
@@ -618,7 +618,7 @@ UTF-8 mode
Windows still uses legacy encodings for the system encoding (the ANSI Code
Page). Python uses it for the default encoding of text files (e.g.
-:func:`locale.getpreferredencoding`).
+:func:`locale.getencoding`).
This may cause issues because UTF-8 is widely used on the internet
and most Unix systems, including WSL (Windows Subsystem for Linux).