adjust for invalid utf8 edge case