diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2019-02-14 23:35:25 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-02-14 23:35:25 (GMT) |
commit | 5723263a3a39a05b6a2f567e0e7771792e6e2f5b (patch) | |
tree | fb203df8147dba4a16a9245307ce6ed76e2802e2 /Doc/library | |
parent | 1093d4293273aac0e71fd8da9d2ab3d5e149bb50 (diff) | |
download | cpython-5723263a3a39a05b6a2f567e0e7771792e6e2f5b.zip cpython-5723263a3a39a05b6a2f567e0e7771792e6e2f5b.tar.gz cpython-5723263a3a39a05b6a2f567e0e7771792e6e2f5b.tar.bz2 |
bpo-30410: Documentation of sys.stdin/out/err update to reflect change in 3.6 (GH-10264)
Documentation of sys.stdin/out/err update to reflect change in 3.6 on Windows to use UTF-8.
Wording by Eryk Sun and Paul Moore.
https://bugs.python.org/issue30410
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/sys.rst | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 9002f94..018f0c9 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1368,13 +1368,30 @@ always available. returned by the :func:`open` function. Their parameters are chosen as follows: - * The character encoding is platform-dependent. Under Windows, if the stream - is interactive (that is, if its :meth:`isatty` method returns ``True``), the - console codepage is used, otherwise the ANSI code page. Under other - platforms, the locale encoding is used (see :meth:`locale.getpreferredencoding`). - - Under all platforms though, you can override this value by setting the - :envvar:`PYTHONIOENCODING` environment variable before starting Python. + * The character encoding is platform-dependent. Non-Windows + platforms use the locale encoding (see + :meth:`locale.getpreferredencoding()`). + + On Windows, UTF-8 is used for the console device. Non-character + devices such as disk files and pipes use the system locale + encoding (i.e. the ANSI codepage). Non-console character + devices such as NUL (i.e. where isatty() returns True) use the + value of the console input and output codepages at startup, + respectively for stdin and stdout/stderr. This defaults to the + system locale encoding if the process is not initially attached + to a console. + + The special behaviour of the console can be overridden + by setting the environment variable PYTHONLEGACYWINDOWSSTDIO + before starting Python. In that case, the console codepages are + used as for any other character device. + + Under all platforms, you can override the character encoding by + setting the :envvar:`PYTHONIOENCODING` environment variable before + starting Python or by using the new :option:`-X` ``utf8`` command + line option and :envvar:`PYTHONUTF8` environment variable. However, + for the Windows console, this only applies when + :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set. * When interactive, ``stdout`` and ``stderr`` streams are line-buffered. Otherwise, they are block-buffered like regular text files. You can |