Properly get the charset, and add a working charset test [IMMUTANT-506]