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

IBM949C encoder modifies state of IBM949 encoder

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: core-libs
    • Labels:

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: