Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code examples contain Non-ASCII character #17

Open
heywiki opened this issue Apr 14, 2020 · 3 comments
Open

Code examples contain Non-ASCII character #17

heywiki opened this issue Apr 14, 2020 · 3 comments

Comments

@heywiki
Copy link

heywiki commented Apr 14, 2020

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:

image

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

@jeff5
Copy link
Member

jeff5 commented Apr 16, 2020

Yes, that's annoying. It's obviously been badly word-processed.

Last year we did a lot to clean up the sources for the book in this repo, so that it built cleanly. Then we discovered a later set than the ones we were using, that is much closer to the paper edition. We set about reconciling the repository version and the paper book. Unfortunately, this is quite time-consuming and we've only been able to get through about 5 chapters.

I've now rebuilt the on-line book from the tip of this repo. I'm sure it still contains warts.

Sorry, this will have broken your links in this post, and any similar bookmarks you have. Also, there is no longer a section on break, which isn't exactly what you were after.

@jeff5
Copy link
Member

jeff5 commented Apr 16, 2020

Bit more on this. Work to update towards the paper version is issue #14.

I have added a publication of ed1.0, intended as a fall-back to how things used to be. However, that is very buggy (relative to the installed Sphinx) and now fails to publish Chapter 1 at all.

@heywiki
Copy link
Author

heywiki commented Apr 16, 2020

Thank you! I am currently using the master right now on github to read the chapters. I think this book is a good crashcourse in python for people comming from java (and js/rhino) even if it has its errors right now. Thats why i am posting. I also discovered the problems of jython catching up with python 3. I am testing my examples with phyton 3.8 right now as well, porting print to print() and more as i discover them, will add notes to the sourcecode examples, when something is not working in v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants