summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-04 10:20:10 (GMT)
committerGitHub <noreply@github.com>2020-11-04 10:20:10 (GMT)
commit3529718925f40d14ed48d281d809187bc7314a14 (patch)
tree1f51f7fb13e93df52a45291fe5384de6e9e09a16 /Doc/library/os.rst
parent0001a1b69ecda47b0406daa88c2943877580bcae (diff)
downloadcpython-3529718925f40d14ed48d281d809187bc7314a14.zip
cpython-3529718925f40d14ed48d281d809187bc7314a14.tar.gz
cpython-3529718925f40d14ed48d281d809187bc7314a14.tar.bz2
bpo-42236: os.device_encoding() respects UTF-8 Mode (GH-23119)
On Unix, the os.device_encoding() function now returns 'UTF-8' rather than the device encoding if the Python UTF-8 Mode is enabled.
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index f9f35b3..3ffcfa0 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -113,6 +113,8 @@ of the UTF-8 encoding:
:ref:`error handler <error-handlers>` being enabled for :data:`sys.stdin`
and :data:`sys.stdout` (:data:`sys.stderr` continues to use
``backslashreplace`` as it does in the default locale-aware mode)
+* On Unix, :func:`os.device_encoding` returns ``'UTF-8'``. rather than the
+ device encoding.
Note that the standard stream settings in UTF-8 mode can be overridden by
:envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware
@@ -808,6 +810,12 @@ as internal buffering of data.
Return a string describing the encoding of the device associated with *fd*
if it is connected to a terminal; else return :const:`None`.
+ On Unix, if the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, return
+ ``'UTF-8'`` rather than the device encoding.
+
+ .. versionchanged:: 3.10
+ On Unix, the function now implements the Python UTF-8 Mode.
+
.. function:: dup(fd)