charset conversion: Avoid accidental converts into NUL byte

Fixes #1492