From 1c7a9828e25c412e223250b1721ed0d66879cda7 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 9 Mar 2017 23:55:19 -0800 Subject: [PATCH] PEP 263: Fix escaping of "\"s in regex and strings (#220) Observed to be missing the backslashes on https://www.python.org/dev/peps/pep-0263/#defining-the-encoding --- pep-0263.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pep-0263.txt b/pep-0263.txt index a965a270f..26bd634f6 100644 --- a/pep-0263.txt +++ b/pep-0263.txt @@ -69,8 +69,11 @@ or:: #!/usr/bin/python # vim: set fileencoding= : -More precisely, the first or second line must match the regular -expression "^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)". +More precisely, the first or second line must match the following +regular expression:: + + ^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+) + The first group of this expression is then interpreted as encoding name. If the encoding is unknown to Python, an error is raised during compilation. There @@ -80,7 +83,7 @@ is ignored. To aid with platforms such as Windows, which add Unicode BOM marks to the beginning of Unicode files, the UTF-8 signature -'\xef\xbb\xbf' will be interpreted as 'utf-8' encoding as well +``\xef\xbb\xbf`` will be interpreted as 'utf-8' encoding as well (even if no magic encoding comment is given). If a source file uses both the UTF-8 BOM mark signature and a