Programs in UTF-8 with no declared coding are accepted
Bug #1608595 reported by
Aaron Crane
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
New
|
Undecided
|
Unassigned |
Bug Description
If a program's source uses UTF-8, but the file's encoding is not declared using a `coding` declaration, Pyflakes accepts the program as valid, even though Python itself refuses it.
$ file coding.py
coding.py: UTF-8 Unicode text
$ cat coding.py
print "¡this file contains ŭnicode!"
$ pyflakes --version
1.2.3
$ pyflakes coding.py
$ python coding.py
File "coding.py", line 1
SyntaxError: Non-ASCII character '\xc2' in file coding.py on line 1, but no encoding declared; see http://
$
Expected outcome: Pyflakes should report a syntax error for such files.
To post a comment you must log in.
What version of Python are you using and what version of Python is PyFlakes installed on?