I'm trying to write an application, that reads all files in a folder and its sub folders.
The problem are file names with special characters like 'ä','ü' and 'ö'. Those are read as '��'.
I develop the program in Eclipse Neon.2 Release (4.6.2) on an arch linux.
I already set Eclipse to UTF-8 encoding. My LANG is nds_DE.UTF-8
And i tried multiple ways to read the filenames (MyFile.listFiles(), DirectoryStream, FileUtils.listFiles (apache.common))
I know, that my Java and Eclipse can handle these special characters, because when they appear in a text file or when i just print them to the console, they are printed correctly.
Has anyone an idea what i can try or why these characters are a problem when reading filenames?
Thank you
Vector<Entry> entrys = new Vector<Entry>();
File[] files = new File(path).listFiles();
for(File f : files){
System.out.println(f)
if(f.isDirectory()){
entrys.addAll(readFilesInPath(f.getPath()));
}else{
entrys.add(new Entry(f.getName(),f.getParent()));
}
}
return entrys;