Open corranwebster opened 4 years ago
I'm adding this issue mainly so we can reject it: I think the correct solution is that we always use UTF-8 and until such time as we need to have a source file with a different encoding, I think we can ignore this possibility.
I think the correct solution is that we always use UTF-8 and until such time as we need to have a source file with a different encoding, I think we can ignore this possibility.
Agreed.
PEP 263 defines a way for Python source code files to declare their encoding by having a special comment which must occur on the first or second line of the file.
For example
gives an error "H103 Wrong copyright header found".
A quick search of the codebase shows that we do have these files. Many of them are autogenerated Sphinx
conf.py
files, but there are some legitimate matches. All of them are requiring UTF-8, and so can be removed now that that is the default encoding for Python 3 and the codebase is Python 3 only.From PEP 263, the regex to match the line is:
^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)