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;
?}