diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -956,6 +956,12 @@ are always available. They are listed h The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` will be used. + The encoding used when writing to :data:`sys.stdout` or :data:`sys.stderr`) + is the value of :envvar:`PYTHONIOENCODING` if defined, otherwise the stream + encoding will be retrieved with :func:`os.device_encoding` (which usually + only works if Python is connected to a tty, not in a pipeline), otherwise a + locale encoding will be used if :func:`locale.getpreferredencoding` returns + it, or it will default to ASCII. .. function:: property(fget=None, fset=None, fdel=None, doc=None)