我想使用java创建一个csv文件并写入支持UTF-8的文件。 我怎么能这样做??
答案 0 :(得分:5)
new OutputStreamWriter(new FileOutputStream("path/to/file"), Charset.forName("UTF-8"))
答案 1 :(得分:1)
Writer myWriter= new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("filename"), "UTF-8"));
try {
myWriter.write(stringdata);
} catch(Exception e){
e.printStacktrace();
}