diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-02 15:49:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 15:49:54 (GMT) |
commit | 4b9aad49992a825d8c76e428ed1aca81dd3878b2 (patch) | |
tree | 3834f555ab9a469313ba1783b1e2e5ca7af94e51 /Doc/using/windows.rst | |
parent | 301822859b3fc34801a06f1090d62f9f2ee5b092 (diff) | |
download | cpython-4b9aad49992a825d8c76e428ed1aca81dd3878b2.zip cpython-4b9aad49992a825d8c76e428ed1aca81dd3878b2.tar.gz cpython-4b9aad49992a825d8c76e428ed1aca81dd3878b2.tar.bz2 |
bpo-42236: Enhance init and encoding documentation (GH-23109)
Enhance the documentation of the Python startup, filesystem encoding
and error handling, locale encoding. Add a new "Python UTF-8 Mode"
section.
* Add "locale encoding" and "filesystem encoding and error handler"
to the glossary
* Remove documentation from Include/cpython/initconfig.h: move it to
Doc/c-api/init_config.rst.
* Doc/c-api/init_config.rst:
* Document command line options and environment variables
* Document default values.
* Add a new "Python UTF-8 Mode" section in Doc/library/os.rst.
* Add warnings to Py_DecodeLocale() and Py_EncodeLocale() docs.
* Document how Python selects the filesystem encoding and error
handler at a single place: PyConfig.filesystem_encoding and
PyConfig.filesystem_errors.
* PyConfig: move orig_argv member at the right place.
Diffstat (limited to 'Doc/using/windows.rst')
-rw-r--r-- | Doc/using/windows.rst | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 275495b..78c1e03 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -614,21 +614,14 @@ Page). Python uses it for the default encoding of text files (e.g. This may cause issues because UTF-8 is widely used on the internet and most Unix systems, including WSL (Windows Subsystem for Linux). -You can use UTF-8 mode to change the default text encoding to UTF-8. -You can enable UTF-8 mode via the ``-X utf8`` command line option, or -the ``PYTHONUTF8=1`` environment variable. See :envvar:`PYTHONUTF8` for -enabling UTF-8 mode, and :ref:`setting-envvars` for how to modify -environment variables. - -When UTF-8 mode is enabled: - -* :func:`locale.getpreferredencoding` returns ``'UTF-8'`` instead of - the system encoding. This function is used for the default text - encoding in many places, including :func:`open`, :class:`Popen`, - :meth:`Path.read_text`, etc. -* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` - all use UTF-8 as their text encoding. -* You can still use the system encoding via the "mbcs" codec. +You can use the :ref:`Python UTF-8 Mode <utf8-mode>` to change the default text +encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode <utf8-mode>` via +the ``-X utf8`` command line option, or the ``PYTHONUTF8=1`` environment +variable. See :envvar:`PYTHONUTF8` for enabling UTF-8 mode, and +:ref:`setting-envvars` for how to modify environment variables. + +When the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, you can still use the +system encoding (the ANSI Code Page) via the "mbcs" codec. Note that adding ``PYTHONUTF8=1`` to the default environment variables will affect all Python 3.7+ applications on your system. @@ -641,7 +634,8 @@ temporarily or use the ``-X utf8`` command line option. on Windows for: * Console I/O including standard I/O (see :pep:`528` for details). - * The filesystem encoding (see :pep:`529` for details). + * The :term:`filesystem encoding <filesystem encoding and error handler>` + (see :pep:`529` for details). .. _launcher: |