上传至linux服务器(即保存在linux磁盘中)成功后中文文件名的zip在服务器中显示乱码,windos服务器(即保存在windows磁盘中)下正常
在linux下解压后(解压路径也是在linux磁盘中)中文目录或文件名乱码,中文全部是?号,手工输入中文文件名linux下是能显示正常的,windows服务器下解压(解压路径是在windows磁盘中)也正常
请问大神们这是什么原因??是因为linux的i18n设置问题么 ??还是说我解压转换代码不对,更奇怪的是上传到临时文件夹乱码使用zip = new ZipFile(zipFile); 还能读取到....
/**
* 上传临时文件
*
* @return page view
*/
public String uploadFile() {
InputStream is = null;
OutputStream os = null;
File filedir = null;
try {
System.out.println("-------上传文件开始----------" + file.getName());
is = new FileInputStream(file);
fileName = URLDecoder.decode(fileName, "UTF-8");
GUIDGenerator gen = new GUIDGenerator();
folderID = gen.genId().toString();
filedir = new File(PropertiesUtils.getProperty("UPLOAD_TEMP_PATH") + folderID);
if (!filedir.exists())
filedir.mkdirs();
File saveFile = new File(filedir, fileName);
os = new FileOutputStream(saveFile);
byte[] byteStr = new byte[1024];
int len = 0;
while ((len = is.read(byteStr)) > 0) {
os.write(byteStr,0,len);
}
} catch (Exception e) {
e.printStackTrace();
try {
if(is != null) {
is.close();
}
if(os != null) {
os.flush();
os.close();
}
if(filedir != null) {
DeleteAppFile.toDeleteFolder(filedir);
}
} catch (IOException e1) {
e1.printStackTrace();
}
} finally{
try {
if(is != null) {
is.close();
}
if(os != null) {
os.flush();
os.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return "uploadSuccess";
}
//解压文件到指定目录
@SuppressWarnings("unchecked")
private void unZipFiles(File zipFile,String descDir, String appNo, String ver) throws Exception{
InputStream in = null;
OutputStream out = null;
ZipFile zip = null;
File file = null;
try {
/*Project p = new Project();
Expand e = new Expand();