JDK-4107300 : need charset alias for ISO-2022-CN.
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1998-01-28
  • Updated: 1998-03-11
  • Resolved: 1998-03-11
Related Reports
Duplicate :  
Description
as part of:
	String.getBytes(String charset)

you cannot use "ISO-2022-CN" which is a valid MIME charset name.  Even though Java supports the charset.  The JDK has a different name for it, "ISO2022CN".

An alias for it needs to be added to sun.io.CharacterEncoding:

just add the line:
        aliasTable.put("iso-2022-cn",         "ISO2022CN");

===========
The same goes for "ISO-2022-KR".  Need the following line for that one:
        aliasTable.put("iso-2022-kr",         "ISO2022KR");

===========
The same goes for "UTF-8".  Need the following line for that one:
        aliasTable.put("utf-8",         "UTF8");
        aliasTable.put("utf8",         "UTF8");

you need the second one in case someone uses a lower case "utf8" it will not find the correct one.

Comments
WORK AROUND Workaround is to determine if you are using ISO-2022-CN and change the string to "ISO2022CN" But this is not a realistic work around since our application has to know how the JDK maps various charsets.
11-06-2004