JNRowe / hubugs

Simple client for GitHub issues
https://hubugs.readthedocs.io/
GNU General Public License v3.0
6 stars 2 forks source link

Unicode Problems #17

Closed sorin-ionescu closed 12 years ago

sorin-ionescu commented 12 years ago

hubugs -p robbyrussell/oh-my-zsh show -f -p 627

Traceback (most recent call last):
  File "/Users/sorin/Library/Python/2.7/bin/hubugs", line 8, in <module>
    load_entry_point('hubugs==0.11.0', 'console_scripts', 'hubugs')()
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/hubugs-0.11.0-py2.7.egg/hubugs/__init__.py", line 340, in main
    parser.dispatch(pre_call=utils.set_api)
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/argh/helpers.py", line 300, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/argh/helpers.py", line 200, in dispatch
    for line in lines:
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/argh/helpers.py", line 277, in _execute_command
    for line in result:
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/argh/helpers.py", line 265, in _call
    for line in result:
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/hubugs-0.11.0-py2.7.egg/hubugs/__init__.py", line 162, in show
    yield tmpl.render(bug=bug, comments=comments, full=True, patch=patch)
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/Jinja2-2.6-py2.7.egg/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/hubugs-0.11.0-py2.7.egg/hubugs/templates/default/view/issue.txt", line 19, in top-level template code
    {% block patch %}
  File "/Users/sorin/Library/Python/2.7/lib/python/site-packages/hubugs-0.11.0-py2.7.egg/hubugs/templates/default/view/issue.txt", line 21, in block "patch"
    {{ patch | highlight }}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1800: ordinal not in range(128)
JNRowe commented 12 years ago

[Extended winter vacation, and now slowly catching up. Sorry for the delay.]

Hmm, I can't replicate this.

I suspect your terminal uses an encoding that is incapable of handling ✗. I don't think it would be that hard to put a workaround in if that is the case, but it I'm not sure how to handle it. The possibilities are the standard str.encode ones; ignore the unusable characters or replace them with ?. Neither of which are particularly desirable, and both would need a pretty hefty warning mixed in if they're triggered.

sorin-ionescu commented 12 years ago

I have tried it in both iTerm and Terminal, which both use UTF-8. It's not a terminal issue. It's definitely a unicode-related Python problem, which we will hopefully never see once the planet transitions to Python 3. I'll upgrade hubugs to HEAD. Perhaps, it has been fixed.

sorin-ionescu commented 12 years ago

I've upgraded to HEAD. It still happens.

Are you using one of the hubugs dependencies argh, github2, html2text, Jinja2, markdown2, Pygments that is newer than what's available on PyPI?

JNRowe commented 12 years ago

Okay, I can produce a similar error by breaking my locale settings and now the traceback makes far more sense. While I wasn't receiving an error initially, I was still receiving garbled output :/

Can you try again with the commit I just pushed?

sorin-ionescu commented 12 years ago

It now works. Thank you.