String helloString ="姓名,年龄 \n李亚希,33";
response.setContentType("application/x-download");
String filedisplay = "hello" + ".csv";
response.addHeader("Content-Disposition", "attachment;filename="
+ filedisplay);
try {
OutputStream out = response.getOutputStream(); //OutputStreamWriter write = new OutputStreamWriter(out , "utf-8");
OutputStreamWriter write = new OutputStreamWriter(out , "gb2312");
write.write(helloString);
write.close();
下载csv 文件中文不乱码
最新推荐文章于 2023-09-13 15:56:09 发布