make UTF-16 truncation workaround a little more reliable