Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Try to detect and reject terminals that are not using utf8 encoding #7

Open
rfk opened this Issue Sep 8, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Owner

rfk commented Sep 8, 2012

No description provided.

I think I may have tripped over this, except I think my terminal is using utf-8 encoding:

Traceback (most recent call last):
File "/usr/bin/pias", line 6, in
res = playitagainsam.main(sys.argv)
File "/usr/lib/python2.7/site-packages/playitagainsam/init.py", line 245, in main
eventlog.close()
File "/usr/lib/python2.7/site-packages/playitagainsam/eventlog.py", line 37, in close
output = json.dumps(data, indent=2, sort_keys=True)
File "/usr/lib64/python2.7/json/init.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 203, in encode
chunks = list(chunks)
File "/usr/lib64/python2.7/json/encoder.py", line 428, in _iterencode
for chunk in _iterencode_dict(o, _current_indent_level):
File "/usr/lib64/python2.7/json/encoder.py", line 402, in _iterencode_dict
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 326, in _iterencode_list
for chunk in chunks:
File "/usr/lib64/python2.7/json/encoder.py", line 384, in _iterencode_dict
yield _encoder(value)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe0 in position 0: unexpected end of data

I had pasted some Hindi characters into the relevant terminal session.

Owner

rfk commented Sep 25, 2012

Right you are, I can reproduce this by pasting hindi chars into my terminal as well.

Owner

rfk commented Sep 25, 2012

@ncoghlan your issue should be fixed by d937b17, which adds correct handling for multi-byte utf8 input sequences. It will also add some protection against non-utf8 terminals, since it now tries to eagerly decode each utf8 character as it is read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment