Skip to content

Commit 7f64ae3

Browse files
gh-107607: Update comment about utf-8 BOM being ignored (#107858)
--------- Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 2c82592 commit 7f64ae3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ which is recognized also by GNU Emacs, and ::
9696

9797
which is recognized by Bram Moolenaar's VIM.
9898

99-
If no encoding declaration is found, the default encoding is UTF-8. In
100-
addition, if the first bytes of the file are the UTF-8 byte-order mark
101-
(``b'\xef\xbb\xbf'``), the declared file encoding is UTF-8 (this is supported,
102-
among others, by Microsoft's :program:`notepad`).
99+
If no encoding declaration is found, the default encoding is UTF-8. If the
100+
implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-order
101+
mark (b'\xef\xbb\xbf') is ignored rather than being a syntax error.
103102

104103
If an encoding is declared, the encoding name must be recognized by Python
105104
(see :ref:`standard-encodings`). The

0 commit comments

Comments
 (0)