handle null characters in invalid utf8 strings