pyterm: don't crash on invalid characters

If invalid characters were read, then pyterm crashed.

This PR lets pyterm print the character `�` for invalid UTF-8 sequences.