Handling of malformed UTF8 strings, bug #524

Authored-by: HAT <hat@fa2.so-net.ne.jp>
Reviewed-by: Ralph Boehme <rb@sernet.de>
typo