diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-19 16:00:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 16:00:40 (GMT) |
commit | 1627c1ee01d4f12fdfd99be8bf534e25494e950d (patch) | |
tree | 89ef60b0bf68615f0b679aead6530292b37ce107 /Doc | |
parent | 35e8f04f1bc6676f6c427ba25bc2587cdd3f8960 (diff) | |
download | cpython-1627c1ee01d4f12fdfd99be8bf534e25494e950d.zip cpython-1627c1ee01d4f12fdfd99be8bf534e25494e950d.tar.gz cpython-1627c1ee01d4f12fdfd99be8bf534e25494e950d.tar.bz2 |
[3.12] gh-107607: Update comment about utf-8 BOM being ignored (GH-107858) (#117016)
(cherry picked from commit 7f64ae30ddc22577ce4101ce0b6601b3548b036f)
Co-authored-by: Terry Jan Reedy tjreedy@udel.edu
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/lexical_analysis.rst | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 256f6ba..103d6ef 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -96,10 +96,9 @@ which is recognized also by GNU Emacs, and :: which is recognized by Bram Moolenaar's VIM. -If no encoding declaration is found, the default encoding is UTF-8. In -addition, if the first bytes of the file are the UTF-8 byte-order mark -(``b'\xef\xbb\xbf'``), the declared file encoding is UTF-8 (this is supported, -among others, by Microsoft's :program:`notepad`). +If no encoding declaration is found, the default encoding is UTF-8. If the +implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-order +mark (b'\xef\xbb\xbf') is ignored rather than being a syntax error. If an encoding is declared, the encoding name must be recognized by Python (see :ref:`standard-encodings`). The |