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

Incorrect Java converters for Gaiji characters(IBM, NEC, NEC IBM characters set)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.6
    • core-libs



      Name: tb29552 Date: 05/17/98


      This bug has been submitted before as 4075413,
      but this bug is in the "Closed, not a bug" state
      for some reason or the other.

      The round trip for this characters:
       - Read file with these characters using Java converter
          ("SJIS" as implicit character decoding string)

       - Write to the file using Java converter ("SJIS" as implicit
           character decoding string)

      gives completely different result.

      I'm using InputStreamReader, OutputStreamWriter for this purpose.
      The example of simplest test:

      try {
          InputStream in = new FileInputStream ("inputfile.txt");
          OutputStream ou = new FileOutputStream("outputfile.txt");

          Reader r = new BufferedReader(new InputStreamReader(in,"SJIS"));
          Writer w = new BufferedWriter(new OutputStreamWriter(ou,"SJIS"));

          char[]buffer = new char[4096];
          int len;
          while ((len=r.read(buffer)) != -1)
             w.write(buffer,0,len);
          r.close();
          w.flush();
          w.close();

        }
        catch(Exception e) {
        }

      The using only OutputStreamWriter gives incorrect result also.

      The same situation when I try to use these classes with default
      encoding string, i.e. using the following constructor
      InputStreamReader(inputStream in).

      The result of System.getProperty("file.encoding") equals
      "SJIS" on my Windows NT machine.
      (Review ID: 29957)
      ======================================================================

            okutsu Masayoshi Okutsu
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: