Hello,
We are currently noticing an issue between our old Java 8 code and our newer Java 11 code around encoding control characters when marshaling an object to xml. Specifically, the tab control character ('\t').
The issue seems to arise when we encode a tab character as part of an attribute.
For a sample object, if we try to add the text `thecomment\r\n\tthecomment` as a value and as an attribute, Java 8 produces something like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><testClass attribute="thecomment
	thecomment"><testElement>thecomment
 thecomment</testElement></testClass>
However, Java 11 produces something like this:
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?><testClass attribute="thecomment thecomment"><testElement>thecomment
thecomment</testElement></testClass>"
For the `testClass` node, the attribute `attribute` has the tab character encoded in Java 8 but not encoded in Java 11. We are also noticing this happening with Java 21.
I'm noticing that this issue occurs with com.sun.xml.bind:jaxb-impl:2.3.2 and com.sun.xml.bind:jaxb-core:2.3.0. However, if I change the version to com.sun.xml.bind:jaxb-impl:2.2.11 and com.sun.xml.bind:jaxb-core:2.2.11, the problem seems to not be present.
Looking through the source code, it looks like the commit that introduced this issue is 9df41fb9bd588294c9e2aa076ad382d5160128a9 (
https://github.com/javaee/jaxb-v2/commit/9df41fb9bd588294c9e2aa076ad382d5160128a9).
It seems like it was a fix for another bug (Bug 25348784?). Possibly related:
https://bugs.openjdk.org/browse/JDK-8172297?jql=labels%20%3D%20bugdb_25348784https://bugs.openjdk.org/browse/JDK-8176508Does this seem correct? I would have thought the tab character would still be getting escaped, however the implementation for `MinimumEscapeHandler` does not seem to handle the tab character (this was the escape handler that was being used in our case).
Unfortunately I couldn't attach a zip file with the entire minimal reproducible example, so instead I have attached the test Java file and the `build.gradle` file. You can switch back and forth between JAXB library versions to toggle the issue on and off.
Cheers
Jarrett