Fix encoding errors when hashing XML

We occasionally get UnicodeEncodeErrors from these two places,
because the XML is a Unicode string, and is implicitly encoded to ascii.
Change a test to get at some Unicode issues.
Fix weird formatting.
Make the repr right.
Write a test for the XML unicode conversion fix.