Latin-1/UTF-8 utilities and code improvements