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

new String( bvar , "ISO2022CN_GB"); returns exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs



      Name: nl37777 Date: 12/08/98


      JDK Version:
      java version "1.2"
      Classic VM (build JDK-1.2-U, green threads, sunwjit)

      String var1 = new String( bvar, "ISO2022CN_GB") causes exception.

      Program that reproduces problem:

      import java.util.*;
       
      public class test2 {
       
          public static void main(String[] args)
          {
          try {
              String var0 = new String("any string");
              byte[] bvar = var0.getBytes("ISO2022CN_GB"); //works
              //byte[] bvar = var0.getBytes("ISO2022KR"); //works
       
              String uniString = new String(bvar, "ISO2022CN_GB"); //does not work
              //String uniString = new String(bvar, "ISO2022KR"); //works
              System.out.println("Unicode String= " + uniString);
              }
              catch (Exception e)
                  {
                  System.out.println("ERROR: " + e.getMessage());
                  }
          }
      }


      Error returned is:
      $java test2
      ERROR: ISO2022CN_GB
      (Review ID: 47367)
      ======================================================================

            okutsu Masayoshi Okutsu
            nlindenbsunw Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: