@@ -108,6 +108,12 @@ Python UTF-8 Mode
108108.. versionadded :: 3.7 
109109   See :pep: `540 ` for more details.
110110
111+ .. versionchanged :: next 
112+ 
113+    Python UTF-8 mode is now enabled by default (:pep: `686 `).
114+    It may be disabled with by setting :envvar: `PYTHONUTF8=0 <PYTHONUTF8> ` as
115+    an environment variable or by using the :option: `-X utf8=0 <-X> ` command line option.
116+ 
111117The Python UTF-8 Mode ignores the :term: `locale encoding ` and forces the usage
112118of the UTF-8 encoding:
113119
@@ -139,31 +145,22 @@ level APIs also exhibit different default behaviours:
139145  default so that attempting to open a binary file in text mode is likely
140146  to raise an exception rather than producing nonsense data.
141147
142- The :ref: `Python UTF-8 Mode  <utf8-mode >` is enabled if the LC_CTYPE locale is
143- ``C `` or ``POSIX `` at Python startup (see the :c:func: `PyConfig_Read `
144- function).
145- 
146- It can be enabled or disabled using the :option: `-X utf8 <-X> ` command line
147- option and the :envvar: `PYTHONUTF8 ` environment variable.
148- 
149- If the :envvar: `PYTHONUTF8 ` environment variable is not set at all, then the
150- interpreter defaults to using the current locale settings, *unless * the current
151- locale is identified as a legacy ASCII-based locale (as described for
152- :envvar: `PYTHONCOERCECLOCALE `), and locale coercion is either disabled or
153- fails. In such legacy locales, the interpreter will default to enabling UTF-8
154- mode unless explicitly instructed not to do so.
155- 
156- The Python UTF-8 Mode can only be enabled at the Python startup. Its value
148+ The :ref: `Python UTF-8 Mode  <utf8-mode >` is enabled by default.
149+ It can be disabled using the :option: `-X utf8=0 <-X> ` command line
150+ option or the :envvar: `PYTHONUTF8=0 <PYTHONUTF8> ` environment variable.
151+ The Python UTF-8 Mode can only be disabled at Python startup. Its value
157152can be read from :data: `sys.flags.utf8_mode <sys.flags> `.
158153
154+ If the UTF-8 mode is disabled, the interpreter defaults to using
155+ the current locale settings, *unless * the current locale is identified
156+ as a legacy ASCII-based locale (as described for :envvar: `PYTHONCOERCECLOCALE `),
157+ and locale coercion is either disabled or fails.
158+ In such legacy locales, the interpreter will default to enabling UTF-8 mode
159+ unless explicitly instructed not to do so.
160+ 
159161See also the :ref: `UTF-8 mode on Windows  <win-utf8-mode >`
160162and the :term: `filesystem encoding and error handler `.
161163
162- .. seealso ::
163- 
164-    :pep: `686 `
165-       Python 3.15 will make :ref: `utf8-mode ` default.
166- 
167164
168165.. _os-procinfo :
169166
0 commit comments