Improved charset handling