You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: