`

IE FF 下载文件名乱码

    博客分类:
  • J2EE
阅读更多
filename=java.net.URLEncoder.encode("人员" + new Date(System.currentTimeMillis())+ ".xls", "UTF-8"); 
        
        response.setHeader("Content-Type", "application/octet-stream");
        response.setHeader("Connection", "close");
        response.setHeader("Content-Disposition", "attachment;filename=" + filename );

上面是 IE

 

 

FF 的话

filename=new String(filename.getBytes("UTF-8"),"ISO8859-1");

 

 

判断IE FF

String agent = request.getHeader("USER-AGENT");
if (null != agent && -1 != agent.indexOf("MSIE")){

}
else if (null != agent && -1 != agent.indexOf("Mozilla")){    

}



 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics