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

Canonical names changed from 1.3.1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • rc1
    • generic
    • solaris_2.6

      The following test shows that the canonical names for some character encodings have changed from 1.3.1. In the case of UTF-16 that's probably just a simple typo. In the cases of UTF-16BE/LE it may indicate a more severe incompatibility in that the 1.4 converters produce/require a byte order mark where the 1.3.1 converters didn't.

      import java.io.InputStreamReader;
      import java.io.IOException;

      public class CheckCanonicalNames {

          public static void main (String[] args) throws IOException {
          
              checkCanonicalName("ASCII");
              checkCanonicalName("Cp1252");
              checkCanonicalName("ISO8859_1");
              checkCanonicalName("UnicodeBig");
              checkCanonicalName("UnicodeBigUnmarked");
              checkCanonicalName("UnicodeLittle");
              checkCanonicalName("UnicodeLittleUnmarked");
              checkCanonicalName("UTF8");
              checkCanonicalName("UTF-16");
              
              checkMappedName("US-ASCII", "ASCII");
              checkMappedName("ISO-8859-1", "ISO8859_1");
              checkMappedName("UTF-8", "UTF8");
              checkMappedName("UTF-16BE", "UnicodeBigUnmarked");
              checkMappedName("UTF-16LE", "UnicodeLittleUnmarked");
          }
          
          private static void checkCanonicalName(String name) throws IOException {
              checkMappedName(name, name);
          }
          
          private static void checkMappedName(String alias, String canonical) throws IOException {
              InputStreamReader reader = new InputStreamReader(System.in, alias);
              if (!reader.getEncoding().equals(canonical)) {
                  System.out.println("Error: name mismatch for " + alias
                          + " - expected " + canonical
                          + ", got " + reader.getEncoding());
                  }
          }
      }

      No output on 1.3.1.

      Output on 1.4 B83:
      Error: name mismatch for UTF-16 - expected UTF-16, got UTF16
      Error: name mismatch for UTF-16BE - expected UnicodeBigUnmarked, got UnicodeBig
      Error: name mismatch for UTF-16LE - expected UnicodeLittleUnmarked, got UnicodeLittle


            ilittlesunw Ian Little (Inactive)
            nlindenbsunw Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: