Olivia5k / doge

wow very terminal doge

Home Page:https://pypi.python.org/pypi/doge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Outputs UTF-8 characters on LATIN1 terminals

h3xx opened this issue · comments

Script does not do appropriate checking of terminal LC_CTYPE locale to test whether the terminal can accept UTF-8 characters. This results in corrupt output.

Suggestion: Transform strings into acceptable character set before outputting.

Steps to reproduce:

$ LANG=en_US LC_CTYPE=en_US rxvt -e bash -c 'doge;read'

OR

$ LANG=en_US LC_CTYPE=en_US xterm -e bash -c 'doge;read'

Results in:

xterm

Haha, that looks fun.

However, there is already some code handling non-UTF-8 cases. I am not sure why this isn't triggering for you, but it sure is for me when I run the snippets you specified.

Have you encountered this problem on a real-life machine or were you just mucking around with running non-UTF-8 stuff?

Cheers for finding inconsistent behavior anyway!

Have you encountered this problem on a real-life machine or were you just mucking around with running non-UTF-8 stuff?

I ran it on the system and terminal I always use, using the configuration I use for pretty much all my computing.

The Python version I ran it under is 2.7.11. I know Python 2 has different string encoding handling than Python 3, so that may be the cause of it.