//处理中文名乱码问题 String userAgent = request.getHeader("User-Agent"); if(StringUtils.contains(userAgent, "Firefox")){//火狐浏览器 fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1"); }else{//IE,google等其他浏览器 fileName = URLEncoder.encode(fileName,"UTF8"); } response.setHeader("Content-Disposition", "attachment;fileName="+ fileName);