Fixing handling of characters from keyboard events

This simpler filter for non-printable characters should fix #206 (may need a check on Windows).