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

HORIZONTAL BAR (U+2015) conversion on ISO-2022-JP is wrong.

XMLWordPrintable

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

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)

      and

      $ java -version
      java version "1.5.0_13"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_13-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      $ uname -a
      Linux Rychely 2.6.18-5-amd64 #1 SMP Tue Oct 2 20:37:02 UTC 2007 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      On JDK 6 UPDATE 3 and JDK 5 UPDATE 13 (linux amd64),
      When I convert HORIZONTAL BAR (U+2015 like '-') to ISO-2022-JP charset,
      it become 0x2129 (like '?').
      In ISO-2022-JP, HORIZONTAL BAR is 0x213d.

      e.g.
      public class Foo
      {
          public static void main(String[] args)
          {
              try{
                  String s = "\u2015";
                  System.out.println(s);

                  byte[] iso2022jp = s.getBytes("iso-2022-jp");
                  for(int i = 0; i < iso2022jp.length; i++){
                      System.out.printf("%02x ", iso2022jp[i]);
                  }
                  System.out.println("");
              }
              catch(Exception ex){
                  ex.printStackTrace();
              }
          }
      }

      $ java Foo
      ¿
      1b 24 42 21 29 1b 28 42

      "1b 24 42" and "1b 28 42" is escape sequence on ISO-2022-JP.
      Charactor data is only "21 29".

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: