解决Invalid byte 2 of 2-byte UTF-8 sequence (dom4j)

 OutputFormat format = OutputFormat.createPrettyPrint();
    format.setEncoding("UTF-8");   
   //关键解决这个问就在此   把原来的FileWriter换成FileOutputStream
   XMLWriter write = new XMLWriter(new FileOutputStream("f:/computerList.xml"),format);
   write.write(docXml);
   write.close();

你可能感兴趣的:(java,xml,F#)