Document doc = builder.build(new StringReader("<?xml version=\"1.0\"?><root att=\"𐀀 𐀀\" />"));
Format format = Format.getCompactFormat().setEncoding("ISO-8859-1");
StAXStreamOutputter outputter = new StAXStreamOutputter(format);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter xsw = soutfactory.createXMLStreamWriter(baos, "ISO-8859-1");
outputter.output(doc, xsw);
String xml = baos.toString();
assertEquals("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + format.getLineSeparator() +
"<root att=\"�� ��\"/>" + format.getLineSeparator(), xml);
}