OpenJDK7 OS X上的file.listFiles()在包含欧元符号的文件名上损坏 [英] file.listFiles() on OpenJDK7 OS X broken on file names that contain a euro symbol
问题描述
似乎以下file.listFiles()在OS X的OpenJDK 7上已损坏.
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");
}
}
似乎是已知 我正在寻找解决方法.这是针对消费类软件的,因此理想情况下,该解决方案将不涉及最终用户的低级纠缠.我希望有一个解决方案,仅代表我进行少量代码更改.
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.
有什么想法吗?
推荐答案
这已在Java Development Kit 7 Update 10(JDK 7u10)中修复.
This is fixed in the Java Development Kit 7 Update 10 (JDK 7u10).
这篇关于OpenJDK7 OS X上的file.listFiles()在包含欧元符号的文件名上损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!