首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

不同浏览器上文件上载,文件名编码有关问题

2013-02-19 
不同浏览器下文件下载,文件名编码问题?/** * deal with the fileName encode in the different browsers *

不同浏览器下文件下载,文件名编码问题

?

/** * deal with the fileName encode in the different browsers * @param request * @param fileName * @return * @throws UnsupportedEncodingException */private String encodeFileName(HttpServletRequest request, String fileName)throws UnsupportedEncodingException {String agent = request.getHeader("USER-AGENT");if (null != agent && -1 != agent.indexOf("MSIE")) {return URLEncoder.encode(fileName, "UTF8").replace("+","%20");} else if (null != agent && -1 != agent.indexOf("Mozilla")) {return "=?UTF-8?B?"+ (new String(Base64.encodeBase64(fileName.getBytes("UTF-8")))) + "?=";} else {return fileName;}}

?

?

?

热点排行