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

(cs) Extended set of character converters not available through Charset API

XMLWordPrintable

    • generic, x86
    • generic, linux

      The current implementation of java.nio.Charset provides access to only a small subset of the character encodings that were supported by the java.io APIs. The test case:

      import java.nio.Charset;
      import java.util.Iterator;

      public class GetAvailableCharsets {

          public static void main (String[] args) {
          
              Iterator charsetIterator = Charset.availableCharsets().keySet().iterator();
              while (charsetIterator.hasNext()) {
                  String charsetName = (String) charsetIterator.next();
                  Charset charset = Charset.forName(charsetName);
                  System.out.println(charset.name() + " - " + charset.displayName());
              }
              // Big5 is both preferred MIME name and our old converter name
              Charset charset = Charset.forName("Big5");
              System.out.println(charset.name() + " - " + charset.displayName());
          }
      }

      produces the following output:

      ISO-8859-1 - ISO-8859-1
      ISO-8859-15 - ISO-8859-15
      US-ASCII - US-ASCII
      UTF-16 - UTF-16
      UTF-16BE - UTF-16BE
      UTF-16LE - UTF-16LE
      UTF-8 - UTF-8
      windows-1252 - windows-1252
      Exception in thread "main" java.nio.UnsupportedCharsetException: Big5
              at java.nio.Charset.forName(Charset.java:329)
              at GetAvailableCharsets.main(GetAvailableCharsets.java:15)


      The expected output would include all character encodings listed at
      http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html
      and then repeat Big5.


      ingrid.yao@Eng 2001-05-29

      Merlin CAP member reports the same complain.

            iris Iris Clark
            nlindenbsunw Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: