Skip to content

Conversation

@jeremylong
Copy link
Member

resolves #73

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds XML 1.1 encoding support to the OWASP Encoder library. The key difference between XML 1.0 and XML 1.1 is that XML 1.1 allows control characters to be represented as character references (e.g., ) rather than being replaced with spaces, making it more permissive for modern applications that need to preserve these characters.

  • Introduced a Version enum to distinguish between XML 1.0 and XML 1.1 encoding rules
  • Updated the encoding logic to emit hexadecimal character references for restricted control characters in XML 1.1
  • Added public API methods forXml11(), forXml11Content(), and forXml11Attribute() for XML 1.1 encoding

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
core/src/main/java/org/owasp/encoder/XMLEncoder.java Adds Version enum and version-aware encoding logic for control characters; XML 1.1 encodes C0/C1 control characters as &#xNN; instead of replacing them with spaces
core/src/main/java/org/owasp/encoder/Encoders.java Defines string constants and encoder instances for the three XML 1.1 contexts (general, content, attribute)
core/src/main/java/org/owasp/encoder/Encode.java Exposes public API methods for XML 1.1 encoding with comprehensive documentation
core/src/test/java/org/owasp/encoder/XML11EncoderTest.java Provides comprehensive test coverage for XML 1.1 encoding across all modes and character ranges, though contains a bug in hex formatting for dynamic tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jeremylong jeremylong requested a review from Copilot November 13, 2025 12:03
Copilot finished reviewing on behalf of jeremylong November 13, 2025 12:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jmanico jmanico merged commit b0b5932 into main Nov 13, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

Add an XML 1.1 encoder

3 participants