make consistent use of utf-8 encoding for the output xml file

(transplanted from d4a693106cccbb55ded9f761cc7c25bf29842b56)
This commit is contained in:
Heng Sin Low 2011-08-08 00:28:18 +08:00
parent 36f5c84ded
commit ba2bbb7107
1 changed files with 4 additions and 4 deletions

View File

@ -190,12 +190,12 @@ public class PackOut
private TransformerHandler createPackoutHandler(
OutputStream packoutStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException {
StreamResult packoutStreamResult = new StreamResult(new OutputStreamWriter(packoutStream,"ISO-8859-1"));
StreamResult packoutStreamResult = new StreamResult(new OutputStreamWriter(packoutStream,"UTF-8"));
SAXTransformerFactory packoutFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
packoutFactory.setAttribute("indent-number", new Integer(4));
TransformerHandler packoutHandler = packoutFactory.newTransformerHandler();
Transformer packoutTransformer = packoutHandler.getTransformer();
packoutTransformer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
packoutTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
packoutTransformer.setOutputProperty(OutputKeys.INDENT,"yes");
packoutHandler.setResult(packoutStreamResult);
packoutHandler.startDocument();
@ -229,12 +229,12 @@ public class PackOut
}
private TransformerHandler createDocHandler(OutputStream docStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException {
StreamResult docStreamResult = new StreamResult(new OutputStreamWriter(docStream,"ISO-8859-1"));
StreamResult docStreamResult = new StreamResult(new OutputStreamWriter(docStream,"UTF-8"));
SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", new Integer(4));
TransformerHandler docHandler = transformerFactory.newTransformerHandler();
Transformer transformer = docHandler.getTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
transformer.setOutputProperty(OutputKeys.ENCODING,"UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT,"yes");
docHandler.setResult(docStreamResult);
docHandler.startDocument();