需要使用两种不同编码方式来处理,在Firefox 11和IE 8下测试通过:
HttpServletRequest request = ServletActionContext.getRequest();
String agent = request.getHeader("User-Agent");
boolean isMSIE = (agent != null && agent.indexOf("MSIE") != -1);
if (isMSIE) {
filename= URLEncoder.encode(filename, "UTF-8");
} else {
filename= new String(filename.getBytes("UTF-8"), "ISO-8859-1");
}
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
原文地址:http://www.cnblogs.com/dule/archive/2012/04/20/2459762.html
本文介绍了一种方法,在Firefox11和IE8下测试通过,用于处理使用两种不同编码方式下载文件的问题。
5万+

被折叠的 条评论
为什么被折叠?



