}
}
protected void setEncoding(String original) throws SAXParseException {
CharEncoding encodingInfo = CharEncoding.create(original);
String e = encodingInfo.name();
if (xmlEncoding == null) {
// special case UTF-8 or UTF-16?
if (e.equals("UTF") && readerXMLEncoding != null
&& readerXMLEncoding.startsWith("UTF")) {
xmlEncoding = readerXMLEncoding;
return;
}
xmlEncoding = e;
if (readerXMLEncoding != null
&& !readerXMLEncoding.equalsIgnoreCase(e)) {
warning(null,
WARN_ENCODING_MISMATCH,
"Encoding on InputStreamReader or FileReader does not match that of XML document. Use FileInputStream. ["
+ readerXMLEncoding + " != " + e + "]");
encodingProblems = true;
}
if (e.equals("UTF"))
return;
if (!encodingInfo.isIANA()) {
warning(null,encodingInfo.isInNIO() ? WARN_NON_IANA_ENCODING
: WARN_UNSUPPORTED_ENCODING, encodingInfo
.warningMessage());
} else if (!original.equalsIgnoreCase(e)) {
warning(null,WARN_NONCANONICAL_IANA_NAME, "The encoding \""
+ original
+ "\" is not the canonical name at IANA, suggest \""