[J2SE] 請問windowXP檔案目錄的標碼問題
我寫了一個方法來列出某個目錄下所有檔案
但是列出來的結果發現
中文檔名正常
但是日文或是簡體出現???
請問這裡我可以如何處理以便正常顯示?
public static String getFileList(String uploadFilePath, int level) throws
IOException {
StringBuilder res = new StringBuilder("");
for(int ll=0;ll<level;ll++){
res.append(" ");
}//for END
String space = res.toString();
res.append(uploadFilePath.split(":")[1]);
res.append("\n");
File f_file = new File(uploadFilePath);
File[] list_file = f_file.listFiles();
for(int i=0; i < list_file.length; i++){
if(list_file[i].isFile()){
if(list_file[i].getName().lastIndexOf("mp3") ==
(list_file[i].getName().length()-3)){
res.append(space+"*" + list_file[i].length());
res.append("\n");
}//if END
}else if(list_file[i].isDirectory()){//is directory
res.append(parserDir.getFileList(list_file[i].getPath(),level+1));
}//else END
}//for END
return res.toString();
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.98.218
推
07/23 15:43, , 1F
07/23 15:43, 1F
→
07/23 16:35, , 2F
07/23 16:35, 2F
→
07/23 16:48, , 3F
07/23 16:48, 3F