Xalan XML to stream transformation produces wrong encoding on Java 11

Solution Verified - Updated -

Issue

An XML transformation from XML (DOMSource) to String (StreamSource) using encoding "ISO-8859-1" produces Unicode decimal encoding instead of ISO-8859-1 within EAP running with JDK 11.
Encoding "ISO-8859-1" is configured by:

 `myTransformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");`

By means of service loader configuration of xalan-2.7.1.redhat-12.jar org.apache.xalan.processor.TransformerFactoryImpl is used as implementation of javax.xml.transform.TransformerFactory.

  • Output from JDK11 Transformation <?xml version="1.0" encoding="ISO-8859-1"?><Name>H&#252;bner</Name
  • Output from JDK 8 Transformation <?xml version="1.0" encoding="ISO-8859-1"?><Name>Hübner</Name>

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.3.4
    • Java
      • Migration from Java 8 to Java 11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content