保证jsp,servelt中编码全为UTF-8,如果还不行,得到文件名之后改变该字符串的编码格式
SmartUpload:
String root="E:/file/";
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
String test=request.getParameter("test");
SmartUpload su=new SmartUpload();
su.initialize(this.getServletConfig(), request,response);
try {
su.upload();
Files files=su.getFiles();
int count=files.getCount();
for(int i=0;i<count;i++){
File f=files.getFile(i);
if(!f.isMissing()){
String name=f.getFileName();
String filename=new String(name.getBytes(),"utf-8");
System.out.println("name!!!!!"+name);
System.out.println("filename"+filename);
f.saveAs(root+filename, File.SAVEAS_PHYSICAL);
System.out.println(f.getFileName());
}
}
} catch