0

I have problems reading files whose name has international characters in Mac OS X Lion. It works fine with Java 6 but it doesn't with Java 7. Also it works with the new Java 7 I/O classes, but I would like not to change the API for the time being.

File f = new File("饮茶.png");
Path p = FileSystems.getDefault().getPath("饮茶.png");
System.out.println("New IO API: " + Files.exists(p));
System.out.println("Old IO API: " + f.exists());

Output:

New IO API: true
Old IO API: false

Is there any way to use the old api with Java 7 and international characters?

Ivan
  • 1,477
  • 3
  • 18
  • 36
  • 1
    "I would like not to change the API for the time being" <-- just do so. There is no reason to stick with `File` anymore in Java 7. At worst, `Path` has `.toFile()`. – fge Jul 11 '13 at 10:23
  • I am not sure one can call "饮茶" *international* characters. To me, they look like very specific national ones. Yet the question is, of course, valid. – Ingo Jul 11 '13 at 10:27

0 Answers0