From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:59:52 +0000 (+0100) Subject: [3.11] gh-107607: Update comment about utf-8 BOM being ignored (GH-107858) (#117015) X-Git-Tag: v3.11.9~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb7a6d470702a19fc4385a676c90ea941d46888d;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-107607: Update comment about utf-8 BOM being ignored (GH-107858) (#117015) (cherry picked from commit 7f64ae30ddc22577ce4101ce0b6601b3548b036f) Co-authored-by: Terry Jan Reedy tjreedy@udel.edu --- diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 65d9de5534a6..76acd3001342 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