gh-148603: Update docs now UTF-8 is default (PEP 686) - #157372
Conversation
Documentation build overview
15 files changed ·
|
| Windows still uses legacy encodings for the system encoding (the ANSI Code | ||
| Page). Python uses it for the default encoding of text files (e.g. | ||
| Page). When the :ref:`Python UTF-8 Mode <utf8-mode>` is disabled, Python | ||
| uses it for the default encoding of text files (for example, |
There was a problem hiding this comment.
I've updated it, is it better now?
|
|
||
| To find where the default locale encoding is used, you can enable | ||
| To find where the default encoding is used, you can enable | ||
| the :option:`-X warn_default_encoding <-X>` command line option or set the |
There was a problem hiding this comment.
@methane: It now looks wrong to emit EncodingWarning if open() is called with no encoding argument, since it defaults to UTF-8 which is fine, no? For me, the purpose of PEP 597 "Add optional EncodingWarning" is to detect when platform dependent locale encoding is used. Am I wrong?
At least, I see one advantage of the current behavior, it helps writing new code which is not platform dependent when running on older Python versions.
There was a problem hiding this comment.
EncodingWarning is a tool for people who want to identify all the places that will be affected by the transition to UTF-8 Mode and verify that the transition will not cause any problems.
Considering that some people may not start thinking about enabling UTF-8 Mode until Python 3.15, I think removing EncodingWarning immediately in Python 3.15 would be premature. How about removing it in Python 3.17 instead?
There was a problem hiding this comment.
Since -X warn_default_encoding is an opt-in option to emit EncodingWarning, I'm fine with emitting EncodingWarning on Python 3.15 when the encoding parameter is omitted. As I wrote, it should help writing new code on Python 3.15 which is compatible (behave as expected) on older Python versions.
Fixes #148603.
Also update headers to sentence case in modified files:
https://devguide.python.org/documentation/style-guide/#capitalization