先在页面做下判断,判断是什么浏览器,然后传一个参数到servlet,进行用不同的编码方式:
火狐的:
火狐的:
response.addHeader("Content-Disposition", "attachment;filename="+ new String(fileName.getBytes("GB2312"),"ISO-8859-1"));
IE及其他:
response.addHeader("Content-Disposition", "attachment; filename="+ URLEncoder.encode(fileName, "UTF-8"));