Old: Non ascii characters found but no encoding specified (PEP 263)


Note: This message was removed in PyLint 0.23. Python 2.5 and above handles this error by raising a SyntaxError exception (see E0001).

Used when some non-ASCII characters are detected but no encoding is specified, as explicited in PEP 263.


If a program contains characters that are beyond the range of ASCII, Python must know what encoding is being used so it can interpret the characters correctly.

Python accepts this setting in a forgiving way. Simply make one of the first two lines a comment with the word "coding" followed by a colon or equals sign and the name of the encoding. For example, all of the following are correct ways to specify UTF-8 encoding:

# coding=utf-8
# I wrote this Python program with this encoding: utf-8
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :

Note that these last two are constructed in such a way that they double as encoding directives for Emacs and VIM, respectively.

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License