I am given the following XML file (test.xml) as input. The XML file does not declare any encoding. I have no control over this file.
<root>
<row label="30°"/>
</root>
° is the encoding for the degree symbol ° in some encoding. Internet Explorer understands it anyway and replaced it with the degree symbol.
My Java program reads this XML using:
After a couple of DOM changes I then output the Document above to File using:
However, the problem is it outputs the XML with the actual degree symbol and not the encoding: