下载文件名乱码
2016-07-12 00:00
316 查看
/** * @return the downloadFileName * @throws UnsupportedEncodingException */ public String getDownloadFileName() throws UnsupportedEncodingException { // 下载文件名(中文需转码) String name = getRequest().getParameter("name"); //转换编码 this.downloadFileName=WebUtils.convertEncodingToUTF8(name);//非必须 //下载文件,Firefox 特殊处理 if (getRequest().getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0) { this.downloadFileName = "=?UTF-8?B?" + (new String(Base64.encode(this.downloadFileName.getBytes("UTF-8")))) + "?="; } else{ this.downloadFileName = java.net.URLEncoder.encode(this.downloadFileName, "UTF-8"); } return this.downloadFileName; }
相关文章推荐
- mongodb笔记
- web文件单独指向地址配置
- java23种设计模式
- Ehcache 整合Spring 使用页面、对象缓存,java
- poi框架excel导出合并列
- shrio学习
- Java中的阻塞和非阻塞IO包各自的优劣思考
- 程序员学习能力提升三要素
- java23种设计模式
- happen-before 规则
- 基于Jersey的RESTful学习
- java.io.FileNotFoundException:文件名、目录名或卷标语法不正确
- 日志LogBack
- Hibernate N+1 问题及解决办法
- Spring 方法注入 非单例bean的调用
- jdk7和8的一些新特性介绍
- <shrio学习>-扩展FormAuthenticationFilter实现动态改变LoginUrl
- 5个常用的Java分布式缓存框架
- 敏捷开发中高质量 Java 代码开发实践
- Vue.js学习 Item13 – 指令系统与自定义指令