diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -754,7 +754,8 @@ It inherits :class:`TextIOBase`. *encoding* gives the name of the encoding that the stream will be decoded or - encoded with. It defaults to ``locale.getpreferredencoding(False)``. + encoded with. It defaults to + :func:`locale.getpreferredencoding(False) `. *errors* is an optional string that specifies how encoding and decoding errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -287,7 +287,8 @@ If *universal_newlines* is ``True``, the file objects *stdin*, *stdout* and *stderr* will be opened as text files with universal newlines support, - using the encoding returned by :func:`locale.getpreferredencoding`. + using the encoding returned by + :func:`locale.getpreferredencoding(False) `. For *stdin*, line ending characters ``'\n'`` in the input will be converted to the default line separator :data:`os.linesep`. For *stdout* and *stderr*, all line endings in the output will be converted to ``'\n'``. @@ -308,6 +309,12 @@ access to other shell features such as filename wildcards, shell pipes and environment variable expansion. + .. versionchanged:: 3.3 + When *universal_newlines* is ``True``, the class uses the encoding + :func:`locale.getpreferredencoding(False) ` + instead of ``locale.getpreferredencoding()``. See the + :class:`io.TextIOWrapper` class for more information on this change. + .. warning:: Executing shell commands that incorporate unsanitized input from an