Updated handling of charsets