读书人

上载csv 文件中文不乱码

发布时间: 2012-09-17 12:06:51 作者: rapoo

下载csv 文件中文不乱码

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();

读书人网 >编程

热点推荐