Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for ignoring encoding or setting default encoding #60

Open
kroeberk opened this issue Apr 16, 2018 · 0 comments
Open

Allow for ignoring encoding or setting default encoding #60

kroeberk opened this issue Apr 16, 2018 · 0 comments

Comments

@kroeberk
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant