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

"x-windows-iso2022jp" encoder table is wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6u12
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      x-windows-iso2022jp encoder outputs NEC private codes even if there are same charactor face in JIS X 0208.
      The codes are follows.

      '\u221A' -> 2D75
      '\u222B' -> 2D72
      '\u22A5' -> 2D76
      '\uFFE2' -> 7C7B


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run a java code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I think x-windows-iso2022jp has same idea of windows-31j. If so, it should be...

      '\u221A' -> 2265
      '\u222B' -> 2269
      '\u22A5' -> 225D
      '\uFFE2' -> 224C

      The reproduce code shuld output ...
      00000000 1B 24 42 22 65 22 69 22 5D 22 4C 1B 28 42

      ACTUAL -
      The reproduce code outputs ...

      00000000 1B 24 42 2D 75 2D 72 2D 76 7C 7B 1B 28 42


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      java.nio.CharBuffer chbuf = java.nio.CharBuffer.wrap("\u221A\u222B\u22A5\uFFE2");
      java.nio.charset.Charset charset = java.nio.charset.Charset.forName("x-windows-iso2022jp");
      java.nio.charset.CharsetEncoder encoder = charset.newEncoder();
      java.nio.ByteBuffer result = encoder.encode(chbuf);
      encoder.reset();
      byte[] resbuf = new byte[result.remaining()];
      result.get(resbuf);
      org.apache.commons.io.HexDump.dump(resbuf, 0, System.out, 0);

      ---------- END SOURCE ----------

            sherman Xueming Shen
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: