Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4546103

cannot read filename with japanese characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • x86
    • windows_2000



      Name: gm110360 Date: 12/03/2001


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

      I have a filename with japanese characters, and i cannot read using a java
      program. I had already submitted bug 4498715, marked as duplicate of 4185525,
      which is now closed as fixed, however it's not fixed, I've just tried and my
      test program fails even with jdk 1.4 beta 3.
      this is the program i use to test:
      ----
      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);
          }
        }
      }
      --------
      in the same dir as the Test.class there are two other sub directory, one called
      OK and one called KO. the OK dir contains some file with ascii characters only
      in their name. the KO dir contains files with japanese filenames, like:
      &#33775;&#12288;&#40845;&#12288;&#22530;
      when i run the test i get a file not found exception, if I use a C program I
      can read the file.
      btw, a simpler test is to use the file chooser demo in the demos directory of
      jdk, if I open the KO directory it is empty, even if there are filename in it...
      PLEASE FIX THIS !!!
      (Review ID: 136630)
      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: