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

ISO2022KR charset uses the wrong encoding (Esc 'A') sequence.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.0
    • 1.1.6, 1.2.0
    • core-libs
    • beta
    • x86, sparc
    • solaris_2.6, solaris_7, windows_95



      Name: rm29839 Date: 05/20/98


      It seems that when using ISO2022KR charset to
      encodes a string,it encodes with ESC 'A' sequence
      rather than with ESC 'C'. But when decoding it
      requires a ESC 'C' sequence (which is correct).
      It happens on both JDK1.1.4 and JDK1.2 beta 3.

      The below is the source use for testing..
      In the generated output.txt, you can see that the
      Esc sequence generated is wrong.


      import java.io.*;
      public class ISO2022 {
          public static void main (String args[])
          {
              String m_encoding="ISO2022KR";
              String output_text="key in some korean text here µóµù¢¾Öabcd";
              File m_file = new File ("output.txt");
              
              try {
                          FileOutputStream oStream = new FileOutputStream(m_file);
                          OutputStreamWriter encode_writer = new OutputStreamWriter( oStream, m_encoding);
                          BufferedWriter b_writer = new BufferedWriter(encode_writer);
                          b_writer.write (output_text, 0, output_text.length());
                          b_writer.flush();
                          System.out.println("Encoding succeed" + output_text);
                      }
              catch (IOException ie)
              {
                  System.out.println ("Encoding not supported!!!!!");
               }
          } //main
      } // iso2022
      (Review ID: 28803)
      ======================================================================

            sherman Xueming Shen
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: