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

(cs) Charset.isSupported() does not check String of encoding name correctly in 5.0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 5.0, 5.0u11
    • core-libs
    • beta
    • generic
    • generic

      According to the following page,
       http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
      JDK5.0 supportes
       x-Big5_Solaris,x-ISO2022-CN-CNS, ISO2022_CN_CNS, x-ISO2022-CN-GB and ISO2022_CN_GB

      However, isSupported() does not check the above encoding correctly.

      ex.
         The document says "x-Big5_Solaris" is supported, but actually isSupported() checks that "x-Big5-Solaris" is
         supported (outputs "true")
        (Please look closely the difference between "_" of "x-Big5_Solaris" and "-" of "x-Big5-Solaris")

      As to other encodings, Please execute the attached test program.


      TEST PROGRAM :

      ------------------>
      import java.nio.charset.*;

      class isSupportedTest1 {
          public static void main( String arg[] ) {
      System.out.println("x-Big5_Solaris" + " is Supported ? : " + Charset.isSupported("x-Big5_Solaris")); /* expected "true" */
      System.out.println("x-Big5-Solaris" + " is Supported ? : " + Charset.isSupported("x-Big5-Solaris"));

      System.out.println("x-ISO2022-CN-CNS" + " is Supported ? : " + Charset.isSupported("x-ISO2022-CN-CNS")); /* expected "true" */

      System.out.println("x-ISO-2022-CN-CNS" + " is Supported ? : " + Charset.isSupported("x-ISO-2022-CN-CNS"));

      System.out.println("ISO2022_CN_CNS" + " is Supported ? : " + Charset.isSupported("ISO2022_CN_CNS")); /* expected "true" */

      System.out.println("ISO2022CN_CNS" + " is Supported ? : " + Charset.isSupported("ISO2022CN_CNS"));

      System.out.println("x-ISO2022-CN-GB" + " is Supported ? : " + Charset.isSupported("x-ISO2022-CN-GB")); /* expected "true" */

      System.out.println("x-ISO-2022-CN-GB" + " is Supported ? : " + Charset.isSupported("x-ISO-2022-CN-GB"));

      System.out.println("ISO2022_CN_GB" + " is Supported ? : " + Charset.isSupported("ISO2022_CN_GB")); /* expected "true" */

      System.out.println("ISO2022CN_GB" + " is Supported ? : " + Charset.isSupported("ISO2022CN_GB"));

          }
      }
      <-----------------

            sherman Xueming Shen
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: