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

(cs) Charset name restrictions are too restrictive

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: nt126004 Date: 02/27/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION : Occurs on all OS versions


      ADDITIONAL OPERATING SYSTEMS : All



      A DESCRIPTION OF THE PROBLEM :
      The constructor for the java.nio.charset.Charset class
      takes a String for the canonical name and an array of
      Strings as aliases. It check all of these using the
      private checkName method, which throws an
      IllegalCharsetNameException if the name contains anything
      but 'A'-'Z', 'a'-'z', '0'-'9', '_', '-', ':', or '.'.
      This is overly restrictive, particularly for aliases,
      preventing the intended use of the name/alias combination
      in certain situations. As an example, a common protocol
      in medical imaging (DICOM), identifies 'ISO-8859-1'
      as 'ISO_IR 100'. It would be nice to be able to alias
      this DICOM name to 'ISO-8859-1', but it is not possible
      given the current code constructs. Additionally, and just
      as problematic, is the fact that aliases cannot be added
      to the existing character sets.
      As a suggested fix, I would recommend that the JDK allow
      alias to be added to existing character set classes and
      that, in all cases, aliases not be checked for strict
      naming correctness (checking the canonical name seems fine
      to me). Additionally, I would recommend that the
      checkName method be scoped publicly so that the developer
      could check the alias name's correctness themselves if
      desired.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      The work-around is somewhat hackish and inelegant. It
      requires the creation of a new CharsetProvider simply to
      provide the aliasing for non-strict names. This work-
      around is dependant upon the current use of the checkName
      method - increased or modified use of this method
      (specifically in the Charset.lookup method) may invalidate
      the work-around in future versions.
      (Review ID: 181774)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            sherman Xueming Shen
            Reporter:
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: