United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7130915 File.equals does not give expected results when path contains Non-English characters on Mac OS X
JDK-7130915 : File.equals does not give expected results when path contains Non-English characters on Mac OS X

Details
Type:
Bug
Submit Date:
2012-01-18
Status:
Closed
Updated Date:
2013-06-26
Project Name:
JDK
Resolved Date:
2012-08-20
Component:
core-libs
OS:
os_x
Sub-Component:
java.io
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7,7u4
Fixed Versions:

Related Reports
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

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

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

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



Hardware and Software, Engineered to Work Together