Struts2文件下载中文乱码解决
设置Tomcat编码格式为UTF-8:修改tomcat-->conf-->server.xml文件,设置URIEncoding为UTF-8,不设置时默认值为ISO8859-1 <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/> 项目及Java文件,JSP文件格式当然也要是UTF-8 java代码 /** * 设置下载文件名 * @param downloadFileName */ public void setDownloadFileName(String downloadFileName) { try { HttpServletRequest request=ServletActionContext.getRequest(); if (request.getHeader("User-Agent").toLowerCase() .indexOf("firefox") > 0) { this.downloadFileName = "=?UTF-8?B?