首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts2 上载中文乱码 win7 上 文件名后面多了加号(“+”)

2012-09-14 
struts2下载中文乱码win7 下 文件名后面多了加号(“+”)?经调试,加号是由于文件名末尾有空格引起的??public

struts2 下载中文乱码 win7 下 文件名后面多了加号(“+”)

?经调试,加号是由于文件名末尾有空格引起的

?

?public String getFileName() {
?? try {?

?? ?this.fileName=fileName.trim();//解决文件名多了加号("+")
??? this.fileName=java.net.URLEncoder.encode(fileName, "UTF-8");//这句很重要,不然文件名为乱码
???? } catch (UnsupportedEncodingException e) {
???? ? e.printStackTrace();
??? }
??return fileName;
?}

热点排行