Hello all who are helping me in this trouble. Thank you for all support We are in right direction but there is still encoding problems, I'm trying everything. Now I'm trying STEP STEP bug finding, starting with outputting fo a file the serialized EORecord public pdfScheda xmlpdf() throws Exception { pdfScheda nextPage = (pdfScheda)pageWithName("pdfScheda"); String myXml = XMLSerializer.serializeProduct(theProduct); System.out.println("JUST SERIALIZED: "+myXml); FileOutputStream out = new FileOutputStream("/tmp/mainXml.xml"); out.write(myXml.getBytes("UTF-8")); out.flush(); out.close();
return nextPage; } file is written to hd, but is NOT utf-8 If you open it with BBedit it renders ok because of UTF-8 xml declaration, but is bad opeding with pico public static String serializeProduct(product aProduct) throws UnsupportedEncodingException, Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { // Create a stream to the output file. BufferedOutputStream byte_output_stream = new BufferedOutputStream(out); NSXMLOutputStream stream = new NSXMLOutputStream(byte_output_stream); // Set the format of the output document (XML). NSXMLOutputFormat format = new NSXMLOutputFormat(true); format.setEncoding("UTF-8"); // turn indentation on stream.setOutputFormat(format); // app // Serialize data to object output stream. stream.writeObject(aProduct); stream.flush(); stream.close(); byte_output_stream.close(); } catch (IOException e) { e.printStackTrace(); } return out.toString("UTF-8"); XMLSerializer.serialize methid here: public static String serializeProduct(product aProduct) throws UnsupportedEncodingException, Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { // Create a stream to the output file. BufferedOutputStream byte_output_stream = new BufferedOutputStream(out); NSXMLOutputStream stream = new NSXMLOutputStream(byte_output_stream); // Set the format of the output document (XML). NSXMLOutputFormat format = new NSXMLOutputFormat(true); format.setEncoding("UTF-8"); // turn indentation on stream.setOutputFormat(format); // app // Serialize data to object output stream. stream.writeObject(aProduct); stream.flush(); stream.close(); byte_output_stream.close(); } catch (IOException e) { e.printStackTrace(); } FileOutputStream justSerializedXml = new FileOutputStream("/tmp/justSerializedXml.xml"); justSerializedXml.write(out.toByteArray()); justSerializedXml.close(); return out.toString("UTF-8"); } also file /tmp/justSerializedXml.xml is lookong bad. Regards Amedeo On 11/ott/06, at 00:42, Travis Cripps wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]
