fix up non-utf8 encodings