Make UTF-8 handling more consistent