`

解决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();
分享到:
评论
1 楼 di1984HIT 2014-01-10  
恩,FileWrite默认是平台编码

相关推荐

Global site tag (gtag.js) - Google Analytics