Skip to content

Requires Unicode terminal #3

@JayFoxRox

Description

@JayFoxRox

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions