UTF-8 <-> UTF-16 conversion fixes.

Might be a fix for #194.