erkin / ponysay

Pony rewrite of cowsay.
GNU General Public License v3.0
1.22k stars 82 forks source link

Unicode characters not supported #275

Open bheadmaster opened 6 years ago

bheadmaster commented 6 years ago

Piping slavic characters (ponysay "š", for example) ponysay 3.0.3, in a termite terminal emulator on Arch Linux system, prints a following error:

Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/bin/ponysay/main.py", line 154, in File "/usr/bin/ponysay/ponysay.py", line 258, in run File "/usr/bin/ponysay/ponysay.py", line 309, in run File "/usr/bin/ponysay/ponysay.py", line 940, in printPony File "/usr/bin/ponysay/ponysay.py", line 1139, in printOutput File "/usr/bin/ponysay/common.py", line 56, in print UnicodeEncodeError: 'utf-8' codec can't encode characters in position 29-30: surrogates not allowed

JockeTF commented 6 years ago

Works for me in GNOME Terminal, Guake, and Termite.

Also on Arch Linux with Ponysay 3.0.3 using the en_US.UTF-8 locale.

DDR0 commented 5 years ago

Running on Debian 8 with Python 3.4, with all ponies enabled, but no unicode in the message, I get a similar error message about 5% of the time. No pony is printed.

Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/bin/ponysay/__main__.py", line 154, in <module>
  File "/usr/bin/ponysay/ponysay.py", line 254, in run
  File "/usr/bin/ponysay/ponysay.py", line 305, in __run
  File "/usr/bin/ponysay/ponysay.py", line 929, in printPony
  File "/usr/bin/ponysay/backend.py", line 116, in parse
  File "/usr/bin/ponysay/common.py", line 80, in printinfo
UnicodeEncodeError: 'ascii' codec can't encode character '\xa9' in position 577: ordinal not in range(128)