Charset handling tests & fixes in implementation.