当前位置: 代码迷 >> Web前端 >> 系统导出中文名的资料
  详细解决方案

系统导出中文名的资料

热度:116   发布时间:2012-09-01 09:33:03.0
系统导出中文名的文件

在jsp中导出中文名的文件,如果不对该中文名做处理导出的就变成了 "CAXK8N1X."的文件名了。
解决方法主要有两个。
1. 这种方式主要是为不同操作系统准备的。
response.setContentType("application/vnd.ms-excel");
String filename = "中文名导出测试.xls";
response.setHeader("Content-disposition", "attachment;filename="+ URLEncoder.encode(filename,"UTF-8"));

2. 如果系统只是在windows下的系统,可如下设置
response.setContentType("application/vnd.ms-excel");
String filename = "中文名导出测试.xls";
response.setHeader("Content-disposition", "attachment;filename="+ new String(filename .getBytes("gbk"), "ISO-8859-1");? );

  相关解决方案