JDK-7130915 : File.equals does not give expected results when path contains Non-English characters on Mac OS X
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 7,7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-01-18
  • Updated: 2013-06-26
  • Resolved: 2012-08-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b51Fixed
Related Reports
Duplicate :  
Relates :  
Description
Platform: Mac OS X 10.7.2 
JDK: 7u4 b225

Download the attached source file FileTest.java, compile it and run in the terminal. The program should create diretories with German characters. The expected output is that, the created directory can be found by running equals() method in java.io.File. Output.txt in the attachment contains the output (running result) on other platforms. From the output, we can see that the file is found. But if we run the program in the terminal on Mac OS X, the file can not be found when we use equals() method. It does not return true, even the two files are the same. Output_mac.txt contains the output on Mac OS X.

If we compile and run FileTest_en.java, then the created file can be found. When directory name is in English, equals() method works fine. 

I also tried Chinese text on Mac OS X, and equals() method also works fine. So far, the problem is only found in German, but maybe it also happens in other EU locales.
The problem also happens in Japanese. 

Compile and run attached FileTest_ja.java, the created file can not be found by java.io.File.equals(). There are only two lines of output in terminal.

Run the same program on other platforms, for example windows, the created file can be found by java.io.File.equals(). There are three lines of output in terminal.
Same problem also happens in Korean.

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/84cd98a5641c
14-08-2012

EVALUATION macos fs uses nfd as its storage form. need nfd->nfc conversion when decode the file path from platform fs.
20-07-2012