Marco Buttu added the comment: You wrote: "It is also possible to specify a different encoding for source files. In order to do this, you can use a special comment line that defines the source file encoding::". I think that is not true, because the line have to be the first line, or right below a comment (just one, as in the case of the shebang). For instance, in this case Python apply the declared coding: $ cat foo.py # The first line is a comment # -*- coding: ascii -*- print('è') # Encoded in UTF-8 $ python foo.py ... SyntaxError: encoding problem: ascii In this case it does not: $ cat foo.py # The first line is a comment # and also the sencond line # -*- coding: ascii -*- print('è') # Encoded in UTF-8 $ python foo.py è But I think you are right that the current doc is confusing. Maybe yon can write something like this: "It is also possible to specify a different encoding for source files. In order to do this, put one special comment line to define the source file encoding: # -*- coding: encoding -*- This coding comment has to be the first line of the file, or the second line in case the first one is the #! line." ---------- nosy: +marco.buttu _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue29381> _______________________________________