请教生成xml文件的中文转码问题。
public class TestXml
{
public TestXml()
{
}
public static void main(String[] args)
{
String xml = "";
xml = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<cobjectbean>"
+ "<typebean name='中文'/>"
+ "</cobjectbean>";
File file = new File("D:/testxml.xml");
try{
file.createNewFile();
Writer out = new FileWriter(file);
out.write(xml);
out.close();
System.out.println("success");
}
catch (IOException ex){
System.out.println("error");
}
}
}
上面是我的源码,问题是这样子的;
通过程序生成一个xml文件,但是当文件中存在中文时,生成的文件使用IE6.0打不开,
请问各位大虾有没有办法。在此谢谢先,急!!
补充一点,之所以使用IE打开,是因为生成的文件需要与其他程序(解析IE可以打开的xml)进行交互,现在其他程序都可以用了,所以不能再修改交互的标准,只能要求我生成的文件可以使用IE打开。