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

XMLEncoder should filter illegal XML characters #11

Open
dflorey opened this issue Oct 16, 2018 · 0 comments
Open

XMLEncoder should filter illegal XML characters #11

dflorey opened this issue Oct 16, 2018 · 0 comments

Comments

@dflorey
Copy link
Collaborator

dflorey commented Oct 16, 2018

JMTE may produce illegal XML output when using XMLEncoder.
XMLEncoder should use something like this to filter illegal Unicode characters (on top of current encoding rules):

int codePoint = text.codePointAt(i);
if (codePoint > 0xFFFF) {
    i++;
}
if ((codePoint == 0x9) || (codePoint == 0xA) || (codePoint == 0xD)
        || ((codePoint >= 0x20) && (codePoint <= 0xD7FF))
        || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD))
        || ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {
    sb.appendCodePoint(codePoint);
}
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