[size=medium][color=green][b]String agent = request.getHeader("user-agent");
response.setContentType("application/x-download");
if(agent.contains("Firefox"))
response.addHeader("Content-Disposition","attachment;filename="+ new String(displayFileName.getBytes("GB2312"),"ISO-8859-1"));
else
response.addHeader("Content-Disposition","attachment;filename=" + URLEncoder.encode(displayFileName, "UTF-8"));
刚刚我也遇到了这个问题,综合上面的回答,发下我的做法,在IE,谷歌,火狐等浏览器测试没问题![/b][/color][/size]
response.setContentType("application/x-download");
if(agent.contains("Firefox"))
response.addHeader("Content-Disposition","attachment;filename="+ new String(displayFileName.getBytes("GB2312"),"ISO-8859-1"));
else
response.addHeader("Content-Disposition","attachment;filename=" + URLEncoder.encode(displayFileName, "UTF-8"));
刚刚我也遇到了这个问题,综合上面的回答,发下我的做法,在IE,谷歌,火狐等浏览器测试没问题![/b][/color][/size]