Clean up charset handling in the parser and add a test for some sanity here.

I still don't have the really awesome one in the test suite.