Prevent writing non-UTF-8 characters to XML