handle unicode/utf8 conversions sanely