The UTF-8 encoding is hard coded in the ToXmlGenerator source code:
if (Feature.WRITE_XML_1_1.enabledIn(_formatFeatures)) {
_xmlWriter.writeStartDocument("UTF-8", "1.1");
} else if (Feature.WRITE_XML_DECLARATION.enabledIn(_formatFeatures)) {
_xmlWriter.writeStartDocument("UTF-8", "1.0");
} else {
return;
}
Once ToXmlGenerator is final, there might not be an easy way to have other encodings such as ISO-8859-1:
<?xml version="1.0" encoding="ISO-8859-1"?>
See this question in Stack Overflow for reference.
The
UTF-8encoding is hard coded in theToXmlGeneratorsource code:Once
ToXmlGeneratorisfinal, there might not be an easy way to have other encodings such asISO-8859-1:See this question in Stack Overflow for reference.