OutputFormat uses UTF-8 as the default encoding, so it really should work. You don't really need to define it explicitly as: outFormat.setEncoding("UTF-8");
You use OutputStream and not a Writer, so the encoding will be really used defined by the format.
The Java source is something like iso8859-1 (depends on your locale), which is
encoded to UTF-16 in the compiled code.
Try to use direct character unicode references (\uxxxx) to define your special characters.
-- Barnabas Davoti Information Architect empolis Scandinavia phone: +47 2414-7976 mobile: +47 4161-8058
Stéphane Toussaint wrote:
I'm trying to use XMLWriter in order to well format an XML String that I've just build from information in DataBase.
An ex : <code>
Element root = doc.addElement("ficheTechnique"); Element elemVehicule = root.addElement("vehicule"); elementCar = elementMoteur.addElement("car"); elementCar.addElement("name").addText("Cylindrée"); elementCar.addElement("value").addText(cylindree + " cm³");
OutputFormat outFormat = OutputFormat.createPrettyPrint(); XMLWriter writer; ByteArrayOutputStream out = new ByteArrayOutputStream(); writer = new XMLWriter(out, outFormat); writer.write(doc); writer.flush(); writer.close(); s = out.toString();
</code>
I'll forward the String s to a JSP page and want to display the XML using XSLT transform.
When I desplay the result I've : Cylindr??e : 1300 cm?? And not : Cylindrée : 1300 cm³
Where's the problem ? I'm using UTF-8 everywhere in my pages...
Thanks in advance.
Steph
------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user