use of org.apache.axiom.core.stream.serializer.writer.OutputStreamXmlWriter in project webservices-axiom by apache.
the class OutputStreamXmlWriterTest method testUnmappableCharacterToCharacterReference.
@Test
public void testUnmappableCharacterToCharacterReference() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmlWriter writer = new OutputStreamXmlWriter(baos, Charset.forName("iso-8859-1"));
writer.setUnmappableCharacterHandler(UnmappableCharacterHandler.CONVERT_TO_CHARACTER_REFERENCE);
writer.write("abc€def");
writer.flushBuffer();
assertThat(baos.toString("iso-8859-1")).isEqualTo("abc€def");
}
Aggregations