It seems that the following file.listFiles() is broken on OpenJDK 7 on OS X.
This code snippet will print "This file has a euro symbol...does't exist".
final String pathname = System.getProperty("user.home") +
"/folderThatContainsAFileWithTheEuroSymbol/";
final File folder = new File(pathname);
for (File file : folder.listFiles()) {
if (!file.exists()) {
System.out.println("This file has a euro symbol in its name, it exists and yet file.exists says it doesn't exist");
}
}
It seems to be a known problem.
I'm looking for a work-around. This is for consumer software, so ideally the solution would involve no low-level chicanery on the part of the end user. I'm hoping there is a solution which solely involves a small code change on my behalf.
There is a suggested solution here, but that involves setting a command line environment variable, which is beyond the realm of many of my users.
Any ideas?