Tweak utf8towc() to return -1 earlier sometimes (instead of -2), and add test program to compare against libc output.