FasterXML / FasterXML/aalto-xml
Allow for ignoring encoding or setting default encoding
- Dominant language
- Java
- Stars
- 306
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
I have a file that reports in its prolog definition that it's UTF-16, when it is indeed UTF-8. I've had to copy the parser class and do some ugly hacks to override the default behaviour (which is to fail when a weird encoding is encountered):
` override def verifyAndSetXmlEncoding(): Unit = {
val enc = CharsetNames.normalize(_textBuilder.contentsAsString)
_config.setXmlEncoding(enc)
/* 09-Feb-2011, tatu: For now, we will only accept UTF-8 and ASCII; could
* expand in future (Latin-1 should be doable)
*/
if ((CharsetNames.CS_UTF8 != enc) && (CharsetNames.CS_US_ASCII != enc)) {
_config.setXmlEncoding("UTF-8")
}
}`
It should be possible to override this behaviour and just set the encoding manually. In this case I have no control over the file, so changing the file is not an option.
Otherwise, great library :)
~Karl
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.