Olivia5k / doge

wow very terminal doge

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-30: ordinal not in range(128) with Python 2.7.5

tcort opened this issue · comments

I get the following error when I attempt to run doge with Python 2.7.5. I'm using a fresh clone, commit fa4c46c

Traceback (most recent call last):
  File "./bin/doge", line 15, in <module>
    core.main()
  File "./doge/core.py", line 366, in main
    shibe.print_doge()
  File "./doge/core.py", line 259, in print_doge
    sys.stdout.write(line)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-30: ordinal not in range(128)

What's the output of /usr/bin/locale? 2.7.5 should handle this just fine. I've even run it on 2.6.5.

$ /usr/bin/locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

One other thing I noticed is that it does printout some phrases in colours when I have the terminal full screen (141x44), but before it prints out the doge, I get the error. I get the error right away when it's 80x24.

Wow, werid. What terminal is that?
Your encoding has to be something ending in .UTF-8, probably en_US.UTF-8. The C encoding will pretty much translate into ascii, which won't work since the terminal Shibe is printed using special UTF-8 block characters.

Can you figure out how to set a proper unicode locale on your system? That should probably fix it.

It worked after changing my locale to en_US.UTF-8

now doge
so enjoy
wow