下载文件firefox中文文件名乱码

 

最近做项目发现为一个问题,在IE,chrome下面,下载文件中文能正常显示,

但是到了firefox下面就显示为一堆乱码,原来的设置是下面的样子

 

response.setContentType("application/vnd.ms-excel")
response.setHeader("Content-disposition", "attachment;filename"+URLEncoder.encode("活动列表.xls","UTF-8"))

 

后来查了下资料按照下面的修改可以了 

response.setContentType("application/vnd.ms-excel")
response.setHeader("Content-disposition", "attachment;filename*=utf-8''"+URLEncoder.encode("活动列表.xls","UTF-8"))

 

参考链接 

http://blogs.msdn.com/b/ieinternals/archive/2010/06/07/content-disposition-attachment-and-international-unicode-characters.aspx

http://greenbytes.de/tech/webdav/draft-reschke-rfc2231-in-http-latest.html

http://qixinglu.com/post/redisposition.html

你可能感兴趣的:(firefox乱码,firefox下载文件乱码)