Hello,

I'm parsing a svg file to complete it. My parser is jdom.
But, my problem is the encoding.
The svg file is utf-8 encoding. There are some accents inside.
When I save it, all the utf-8 characters loaded are not utf-8 saved.
I do not see where is the mistake.
Here's my little code :
Loading :
     // Build the document with SAX and Xerces, no validation
     SAXBuilder builder = new SAXBuilder();
      // Create the document
      File inputFile = new File(pathName + fileName); // rajout 040105
      FileInputStream fileInputStream = new FileInputStream(pathName +
fileName);
      InputStreamReader inputStreamReader = new
InputStreamReader(fileInputStream, "UTF-8");

      //File fFile = new File(new String(pathName + fileName));
      Document doc = builder.build(inputStreamReader, "UTF-8");
      Element nRoot = doc.getRootElement();
Parsing (not viewed)
Saving:
    XMLOutputter outputter = new XMLOutputter("", false, "UTF-8");
    FileWriter writer = new FileWriter(sFileName);
    outputter.setEncoding("UTF-8");
    outputter.output(doc, writer);
    writer.close();

If any one has got an idea, thank you.

Best regards,

Frederic Lanic


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to