-
Notifications
You must be signed in to change notification settings - Fork 25
Description
When trying out code examples by copy & paste it from the browser into a sourcecode editor that uses UTF-8 by default, you at first don't recognize that some code examples contain non ASCII characters, which results in the error message
File "<string>", line None
SyntaxError: Non-ASCII character in file 'wrong_encoding.py', but no encoding declared; se
see http://www.python.org/peps/pep-0263.html for details
This is very confusing for beginners , time consuming to figure out and breaks the flow when learning. When you switch the encoding of the file to ASCII, you then can see the error. The code examples actually use the wrong character, the minus in that case is not the real minus character, its dash from UTF-8 charset:
The example shown is from chapter 1, break statement:
https://jython.readthedocs.io/en/latest/chapter1/#break-statement
I also had a similar error with "sports team" example in chapter 3.
https://jython.readthedocs.io/en/latest/chapter3/#example-code
