Skip to content

[core] Fix XMLRenderer with UTF-16 #2874

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

Merged
merged 2 commits into from
Nov 23, 2020
Merged

Conversation

adangel
Copy link
Member

@adangel adangel commented Oct 26, 2020

Describe the PR

When using UTF-16 as encoding, the XMLRenderer produced
invalid XML: When inserting the linebreak encoded with the
given encoding "UTF-16", a BOM was created. This inserted additional
characters U+FEFF in the middle of the file, which is not allowed.

A partial workaround for this issue would be, to use "UTF-16BE" as
encoding instead. This doesn't create a BOM. However, the resulting XML
file is then completely without a BOM.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by travis)
  • Added (in-code) documentation (if needed)

When using UTF-16 as encoding, the XMLRenderer produced
invalid XML: When inserting the linebreak encoded with the
given encoding "UTF-16", a BOM was created. This inserted additional
characters U+FEFF in the middle of the file, which is not allowed.

A partial workaround for this issue would be, to use "UTF-16BE" as
encoding instead. This doesn't create a BOM. However, the resulting XML
file is then completely without a BOM.
@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Oct 26, 2020
@adangel adangel added this to the 6.30.0 milestone Oct 26, 2020
@ghost
Copy link

ghost commented Oct 26, 2020

1 Message
📖 This changeset introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel self-assigned this Nov 23, 2020
@adangel adangel merged commit cefd5a6 into pmd:master Nov 23, 2020
@adangel adangel deleted the xmlrenderer-utf16 branch November 23, 2020 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant