Don't crash on getting invalid UTF-8 from keyboard

Print warnings at exit instead if this happens.