Improve Charset detection and conversion