setting Marshaller CharacterEncodingHandler with utf-8 does not work · Issue #617 · javaee/jaxb-v2 (original) (raw)

This repository was archived by the owner on Feb 5, 2019. It is now read-only.

This repository was archived by the owner on Feb 5, 2019. It is now read-only.

@glassfishrobot

Description

@glassfishrobot

when calling
marshaller.setProperty(CharacterEscapeHandler.class.getName(), new
CustomCharactertEscapeHandler());

this handler will be ignored during marshalling when
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); will be used.

I checked the source-code of MarshallerImpl and the XMLWriter created internally for UTF-Encoding
simply ignores users CharacterEscapeHandler.

by running the chracter-escape-sample from the binary-download you can verify this behavior, when
you change the encoding from US-ASCII to UTF-8.

tim

Environment

Operating System: Mac OS X
Platform: Macintosh

Affected Versions

[2.1.9]