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

Requires Unicode terminal #3

Open
JayFoxRox opened this issue Feb 21, 2019 · 0 comments
Open

Requires Unicode terminal #3

JayFoxRox opened this issue Feb 21, 2019 · 0 comments

Comments

@JayFoxRox
Copy link
Member

The error which forces non-ASCII, is in:

print("<!-- Decoding symbol " + str(c) + ": \"" + symbol + "\" -->")

This is affecting Python 2 and Python 3.

A reproduction of what happens in ASCII terminals:

$ python2 -c "print(u'\xa0')" 
$ PYTHONIOENCODING=ascii python2 -c "print(u'\xa0')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 0: ordinal not in range(128)
$ PYTHONIOENCODING=ascii python3 -c "print(u'\xa0')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xa0' in position 0: ordinal not in range(128)

A workaround is to remove that line altogether.

However, to fix this problem for everyone, we should add an error handler for this line, which catches the error and simply doesn't print the symbol part (symbol) of the message (if the terminal can't print it).

It's a rare issue (most terminals will support some form of unicode).

(This issue was originally reported by @kaosengr)

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

No branches or pull requests

1 participant