Fix inconsistency in packout - the xml file encoding property is defined as ISO-8859-1 but the file stream is written with utf-8. I had problems importing the generated files, all accents and special characters were imported wrongly.

This commit is contained in:
Carlos Ruiz 2011-02-27 00:07:26 -05:00
parent 5ace44da03
commit c58e6f00c0
2 changed files with 4 additions and 4 deletions

View File

@ -173,7 +173,7 @@ public class PackOut extends SvrProcess
boolean success = (new File(packagename+File.separator+"doc"+File.separator)).mkdirs(); boolean success = (new File(packagename+File.separator+"doc"+File.separator)).mkdirs();
String file_document = packagename+File.separator+"doc"+File.separator+rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+"Doc.xml"; String file_document = packagename+File.separator+"doc"+File.separator+rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+"Doc.xml";
packageDocStream = new FileOutputStream (file_document, false); packageDocStream = new FileOutputStream (file_document, false);
StreamResult streamResult_document = new StreamResult(new OutputStreamWriter(packageDocStream,"utf-8")); StreamResult streamResult_document = new StreamResult(new OutputStreamWriter(packageDocStream,"ISO-8859-1"));
SAXTransformerFactory tf_document = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); SAXTransformerFactory tf_document = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
tf_document.setAttribute("indent-number", new Integer(4)); tf_document.setAttribute("indent-number", new Integer(4));
TransformerHandler packageDocument = tf_document.newTransformerHandler(); TransformerHandler packageDocument = tf_document.newTransformerHandler();
@ -246,7 +246,7 @@ public class PackOut extends SvrProcess
success = (new File(packagename+File.separator+ "dict"+File.separator)).mkdirs(); success = (new File(packagename+File.separator+ "dict"+File.separator)).mkdirs();
String file_menu = packagename+File.separator+ "dict"+File.separator+"PackOut.xml"; String file_menu = packagename+File.separator+ "dict"+File.separator+"PackOut.xml";
packOutDocStream = new FileOutputStream (file_menu, false); packOutDocStream = new FileOutputStream (file_menu, false);
StreamResult streamResult_menu = new StreamResult(new OutputStreamWriter(packOutDocStream,"utf-8")); StreamResult streamResult_menu = new StreamResult(new OutputStreamWriter(packOutDocStream,"ISO-8859-1"));
SAXTransformerFactory tf_menu = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); SAXTransformerFactory tf_menu = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
tf_menu.setAttribute("indent-number", new Integer(4)); tf_menu.setAttribute("indent-number", new Integer(4));
TransformerHandler packOutDocument = tf_menu.newTransformerHandler(); TransformerHandler packOutDocument = tf_menu.newTransformerHandler();

View File

@ -190,7 +190,7 @@ public class PackOut
private TransformerHandler createPackoutHandler( private TransformerHandler createPackoutHandler(
OutputStream packoutStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException { OutputStream packoutStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException {
StreamResult packoutStreamResult = new StreamResult(new OutputStreamWriter(packoutStream,"utf-8")); StreamResult packoutStreamResult = new StreamResult(new OutputStreamWriter(packoutStream,"ISO-8859-1"));
SAXTransformerFactory packoutFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); SAXTransformerFactory packoutFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
packoutFactory.setAttribute("indent-number", new Integer(4)); packoutFactory.setAttribute("indent-number", new Integer(4));
TransformerHandler packoutHandler = packoutFactory.newTransformerHandler(); TransformerHandler packoutHandler = packoutFactory.newTransformerHandler();
@ -229,7 +229,7 @@ public class PackOut
} }
private TransformerHandler createDocHandler(OutputStream docStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException { private TransformerHandler createDocHandler(OutputStream docStream) throws UnsupportedEncodingException, TransformerConfigurationException, SAXException {
StreamResult docStreamResult = new StreamResult(new OutputStreamWriter(docStream,"utf-8")); StreamResult docStreamResult = new StreamResult(new OutputStreamWriter(docStream,"ISO-8859-1"));
SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", new Integer(4)); transformerFactory.setAttribute("indent-number", new Integer(4));
TransformerHandler docHandler = transformerFactory.newTransformerHandler(); TransformerHandler docHandler = transformerFactory.newTransformerHandler();