JDK-4498715 : filename with japanese characters
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.3.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-31
  • Updated: 2001-11-28
  • Resolved: 2001-11-28
Related Reports
Duplicate :  
Description

Name: ddT132432			Date: 08/31/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


i'm trying to open and read a file with a FileReader. the problem is the name
of the file: if it has japanese o some other "strange" character i cannot open.
i get FileNotFoundException, however the file is there. if i try a filename
with only normal letters all goes ok.


import java.io.*;

//  file not found ???

public class Test {

  static String filename = "KO";
  //static String filename = "OK";

  public static void main(String[] args) {
    try {
      File f = new File(filename);
      File[] dir = f.listFiles();
      for (int i=0; i<dir.length; i++) {
        BufferedReader br = new BufferedReader(new FileReader(dir[i].getAbsoluteFile()));
        String letta;
        while ((letta=br.readLine()) != null) {
          System.out.println(letta);
        }
        System.out.println("-------");
      }
    } catch(Exception e) {
      System.out.println(e);
    }
  }
}


the class Test shows the problem.

I want to read the files in a directory (KO or OK)
and then print their contents.
the files are url shortcuts for internet explorer.
(with .url extension). i want to manipulate these
internet shorcuts created by explorer.

if I use the OK directory all works. if I use the
KO directory i get a FileNotFound exception.

this problem is verified under window 2000, using
jdk 1.3.1 and 1.4.0 beta 1 (build 65) from sun
and ibm jdk 1.3.0

please note that the same code runs correctly under
Linux with jdk 1.3.1 from sun and from blackdown.

the problem shown here is for reading files, but
the same happens when trying to create a file with
a name like the ones in dir KO.

since under linux works i thinks that's a bug of
the windows jdk. am i wrong?
(Review ID: 130951) 
======================================================================