文件下载时,解决不同浏览器文件名乱码问题
public static String encodeFileName(HttpServletRequest request, String pFileName) { String userAgent = request.getHeader("USER-AGENT"); try { if (userAgent.contains("msie") || userAgent.contains("like gecko")) { pFileName = URLEncoder.encode(pFileName, "utf-8"); } else { pFileName = new String(pFileName.getBytes("utf-8"), "iso8859-1"); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return pFileName; }