可能重复:
如何用 Java 编写 UTF-8 文件?
我想使用java创建一个csv文件并写入支持UTF-8的文件。我怎样才能做到这一点。?
new OutputStreamWriter(new FileOutputStream("path/to/file"), Charset.forName("UTF-8"))
Writer myWriter= new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("filename"), "UTF-8"));
try {
myWriter.write(stringdata);
} catch(Exception e){
e.printStacktrace();
}