tspivey / tdsr

A console screen reader for macOS and Linux
GNU General Public License v3.0
78 stars 18 forks source link

Crash on Malformed 8-bit Terminal Output #12

Closed CMB closed 7 years ago

CMB commented 7 years ago

tdsr crashes if the thing displayed on the screen is not well-formed UTF-8. To reproduce: start tdsr, and run: echo -ne '\xf3' to see a traceback.

Spotted on both Mac and Linux.

Don't know of a really clean fix for this at the moment.

tspivey commented 7 years ago

We should be able to run with the incremental decoder's error mode set to replace:

decoder = codecs.getincrementaldecoder('utf-8')(errors='replace')

I'm testing with that, though screen seems to avoid the issue.