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

IBM949C encoder modifies state of IBM949 encoder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 7
    • core-libs

      In the transcript below, the first and third lines of output should be identical.

       $ cat IBM949.java; jver 7 jr IBM949

      public class IBM949 {

          public static void main(String[] args) throws Throwable {
              encode("IBM949", '\\');
              encode("IBM949C", '\\');
              encode("IBM949", '\\');
              encode("IBM949C", '\\');
          }

          static void encode(String cs, char... chars) throws Throwable {
      byte[] bytes = new String(chars).getBytes(cs);

              for (int j = 0; j < bytes.length; j++) {
      if (j > 0)
      System.out.print(' ');
      byte b = bytes[j];

                  System.out.printf("%02x", b & 0xff);
      }
      System.out.print("\n");
          }
      }
      ==> javac -Xlint:all IBM949.java
      ==> java -esa -ea IBM949
      82
      5c
      5c
      5c

            sherman Xueming Shen
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: