Improved charset conversion
Updated unit tests