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

(cs) Charset.aliases() returns nonempty alias sets for UTF-XXX

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_8

      Description



      Name: auR10023 Date: 03/14/2003



      java.nio.charset.Charset.aliases() returns non empty alias sets for:
      UTF-8, UTF-16BE, UTF-16LE, UTF-16 but according to the IANA Charset Registry
      these charsets have no aliases.

      Here is the example:

      -------test.java---------

      import java.nio.charset.*;

      public class test {
          public static void main (String [] args) {
              Charset c = null;
              String [] chrs = { "UTF-8", "UTF-16BE", "UTF-16LE", "UTF-16"};
                                   
              for (int i = 0; i < chrs.length; i++) {
                  try {
                      c = Charset.forName(chrs[i]);
       
                      if (c.aliases().size() > 0) {
                          System.out.println("Charset " + chrs[i] +
                                              " has non empty set of aliases");
                      }
                  } catch(IllegalCharsetNameException e) {
                      System.out.println("Unexpected " + e);
                  } catch (UnsupportedCharsetException e) {
                      System.out.println("Unexpected " + e);
                  }
              }
          }
      }

      Here is the result
      #java -version

      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b16)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b16, mixed mode)

      #java test

      Charset UTF-8 has non empty set of aliases
      Charset UTF-16BE has non empty set of aliases
      Charset UTF-16LE has non empty set of aliases
      Charset UTF-16 has non empty set of aliases

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            mr Mark Reinhold
            Reporter:
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: