summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSunghyun Kim <sh@sunghyun.io>2024-03-19 15:51:12 (GMT)
committerGitHub <noreply@github.com>2024-03-19 15:51:12 (GMT)
commit7f64ae30ddc22577ce4101ce0b6601b3548b036f (patch)
tree3f96f5619700202e4c23aae8b62212b841996d03 /Doc/reference
parent2c82592ab463f1f38237919a12145f34eaadda23 (diff)
downloadcpython-7f64ae30ddc22577ce4101ce0b6601b3548b036f.zip
cpython-7f64ae30ddc22577ce4101ce0b6601b3548b036f.tar.gz
cpython-7f64ae30ddc22577ce4101ce0b6601b3548b036f.tar.bz2
gh-107607: Update comment about utf-8 BOM being ignored (#107858)
--------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/lexical_analysis.rst7
1 files changed, 3 insertions, 4 deletions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index f0b3d0a..41ea89f 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