shell: fix UTF-8 problem

The shell terminates the input on the first character that is not in ASCII and ignores errors in the read callback.
This PR lets the shell handle UTF-8 characters correctly and handles input errors.