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 @@ -238,17 +238,25 @@ process should be captured into the same file handle as for *stdout*. When *stdout* or *stderr* are pipes and *universal_newlines* is - :const:`True` then the output data is assumed to be encoded as UTF-8 and - will automatically be decoded to text. All line endings will be converted - to ``'\n'`` as described for the universal newlines ``'U'`` mode argument - to :func:`open`. + ``True``, the output data will be decoded to text automatically + using the encoding returned by + :func:`locale.getpreferredencoding(False) `. + All line endings will be converted to ``'\n'`` using universal newlines + mode as described for the :class:`io.TextIOWrapper` class when the + *newline* argument to its constructor is ``None``. - If *shell* is :const:`True`, the specified command will be executed through + If *shell* is ``True``, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the enhanced control flow it offers over most system shells and still want 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