导出文件名乱码解决方案:

1 String agent = request.getHeader("User-Agent");
2 boolean isMSIE = (agent != null && agent.indexOf("MSIE") != -1);
3 if( isMSIE ){
4   finalFileName = java.net.URLEncoder.encode(exportFileName,"UTF8");
5 }else{
6   finalFileName = new String(exportFileName.getBytes("UTF-8"), "ISO-8859-1");
7 }
8             
9 response.setHeader("Content-Disposition", "attachment; filename=\"" + finalFileName + "\"");//设置为浏览器弹出下载提示框,而非直接在浏览器中打开

 

相关文章:

  • 2021-11-30
  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
猜你喜欢
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案