jaxb-api icon indicating copy to clipboard operation
jaxb-api copied to clipboard

Question: Unicode character escape/unescape support?

Open mattrpav opened this issue 3 months ago • 1 comments

Came across this question and I recall that at one point JAXB did not support escaping/unescaping unicode characters when marshalling.

Has this been addressed in more recent versions?

mattrpav avatar Oct 02 '25 14:10 mattrpav

Is this what you're looking for ?

org.glassfish.jaxb.runtime.v2.runtime.MarshallerImpl#createEscapeHandler

You can define your own character escape handler when marshalling by setting property org.glassfish.jaxb.characterEscapeHandler or org.glassfish.jaxb.core.marshaller.CharacterEscapeHandler on your Marshaller instance

https://github.com/eclipse-ee4j/jaxb-ri/blob/98df7665cd40d0d87d9eabdcb244acae7214ab52/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/MarshallerImpl.java#L449-L458

laurentschoelens avatar Oct 02 '25 15:10 laurentschoelens