struts2+was中文乱码问题求解
javaweb项目部署在was上,was是在linux上,我从页面上传文件到服务器上时,上传成功后发现,中文文件名是乱码,但文件内容是正确的。整个web项目编码是utf-8,也有过滤器,求解是哪里的字符集出错了?
上传代码
public String execute() throws IOException {
String realpath = ServletActionContext.getRequest().getRealPath(
"/files");
System.out.println(realpath);
if (image != null) {
File sorcedir = new File(realpath);
if (!sorcedir.exists()) {
sorcedir.mkdirs();
}
for (int i = 0; i < image.length; i++) {
// System.out.println("imageFileName===" + imageFileName);
// System.out.println("imageContentType===" + imageContentType);
File savefilr = new File(sorcedir, imageFileName[i]);
FileUtils.copyFile(image[i], savefilr);
}
}
return SUCCESS;
}