Randomly-guessed fix for UnicodeDecodeError's when generating reports.

This may not be the right way to fix this, and this is still not
perfect (error messages have encoding glitches). But at least XML
reports are generated correctly.