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

CharToByteBig5_HKSCS does not convert Unicode 2.1 code points back to HKSCS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • core-libs
    • hopper
    • generic
    • generic
    • Verified



      Name: pa48320 Date: 02/07/2002


      CharToByteBig5_HKSCS needs to have mapping from Unicode 2.1 code points to HKSCS for backward compatibility.

      http://www.info.gov.hk/digital21/eng/hkscs/download/big5-iso.txt

      An example shown as the following diagram.

             ByteToCharBig5_HKSCS CharToByteBig5_HKSCS
      0xfa45 --------------------> U+42b5 ---------------------> 0xfa45
                                   U+e005 --(this is missing)--> 0xfa45

      The following test case returns "fa,45" in JDK 1.3.1 and "37" (a question mark) in JDK 1.4.0-rc.

      ########## code ##########
      import java.util.*;
      import java.io.*;
      import java.lang.*;

      class chatToByte {
        public static void main(String args[]) throws UnsupportedEncodingException
        {
          try
          {
            String str = "\ue005";
            String enc = "Big5_HKSCS";
            byte b[] = str.getBytes(enc);
            for (int i = 0; i < b.length; i++)
            {
              if (i == b.length - 1)
              {
                System.out.print(Integer.toHexString(((int)b[i]) & (0xff)) + "\n");
              } else {
                System.out.print(Integer.toHexString(((int)b[i]) & (0xff)) + ",");
              }
            }
          } catch (UnsupportedEncodingException e) {
          }
        }
      }
      (Review ID: 139342)
      ======================================================================

            ilittlesunw Ian Little (Inactive)
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: