Handle locales and UTF-8/ISO-8859-1 more correctly