Improve error messages when a string, bytes or bytearray object of length 1 is expected.