JDK-4493901 : Codepage aliases for EURO codepages missing
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 1.3.1_13,1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_8
  • CPU: generic,sparc
  • Submitted: 2001-08-20
  • Updated: 2004-04-23
  • Resolved: 2004-04-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
1.4.2_05 05Fixed
Name: ddT132432			Date: 08/20/2001

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

When trying to use the character conversion class ByteToCharCp1141 and other
EURO codepages (like 1140, 1142 etc.) one has to use codepage name "Cp1141". It
is not possible to use solely "1141" like with pages "500" or "273". I suppose,
this is due to some missing aliases in class CharacterConversion's private
aliasTable Hashtable.
The main problem is, that conversion between Windows codepages and EDBCIC
codepage 1141, which is used on our IBM host does not work correctly using the
IBM provided JMS implementation classes. I already submitted this bug to IBM,
but I think a better fix for the problem would be, to simply include an alias
for "Cp1141" in above mentioned class. There are already similar aliases for
other EDBCIC pages like "Cp273" and "Cp500".

The following class shows the problem by listing the supported codepages and
their aliases (if present):

import java.util.*;
public class EncodingTest
    public static void main(String[] args)
        int i;
        int max = 6000;
        if(args.length == 1)
            max = Integer.parseInt(args[0]) + 1;

        byte[] bytes = { (byte) 'h', (byte) 'e', (byte) 'l', (byte) 'l', (byte) 'o' };
        String enc, cpenc, cp2enc, string, alias=null;
        System.out.println("EncodingTest Start     " + new Date());
        System.out.println("\n\n  System properties ");
        System.out.println("\n\n  ================= ");
        Properties p = System.getProperties();
        System.out.println("\n\n  Memory usage ");
        System.out.println("\n\n  ============ ");
        Runtime rt = Runtime.getRuntime();
        System.out.println("  Total Memory = " + rt.totalMemory() +
                           "  Free Memory = " + rt.freeMemory());
        System.out.println("\n\n  Code page support ");
        System.out.println("\n\n  ================= ");
        for(i = 0; i < max; i++)
            enc = String.valueOf(i);

                string = new String(bytes, enc);
                System.out.println("  Encoding " + enc + " is supported");
		alias = sun.io.CharacterEncoding.aliasName(enc);
		if ( alias != null )
		    System.out.println("Alias for encoding "+enc+": "+alias);
            catch(java.io.UnsupportedEncodingException e)
		alias = sun.io.CharacterEncoding.aliasName(enc);
		if ( alias != null )
		    System.out.println("Alias for encoding "+enc+": "+alias);
	    //System.out.println("  Encoding "+enc+" is unsupported");
	       Now try to encode the string using the codepage no. prepended with
	       "Cp" to find out whether the codepage is supported using its IANA name
	    try {
		cpenc = "Cp"+enc;
		string = new String(bytes, cpenc);
		System.out.println("  Encoding " + cpenc + " is supported");
		alias = sun.io.CharacterEncoding.aliasName(cpenc);
		if ( alias != null )
		    System.out.println("Alias for encoding "+cpenc+": "+alias);
		try {
		    cp2enc = "CP"+enc;
		    string = new String(bytes, cp2enc);
		    System.out.println("  Encoding " + cp2enc + " is supported");
		    alias = sun.io.CharacterEncoding.aliasName(cp2enc);
		    if ( alias != null )
			System.out.println("Alias for encoding "+cp2enc+": "+alias);
		}catch(java.io.UnsupportedEncodingException ue2){
		    System.out.println("  Encoding "+cp2enc+" is unsupported");
	    }catch(java.io.UnsupportedEncodingException ue){
		//System.out.println("  Encoding "+enc+" is unsupported");

        System.out.println("\n\nEncodingTest End");

(Review ID: 130296) 

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.2_05 generic tiger-beta2 FIXED IN: 1.4.2_05 tiger-beta2 INTEGRATED IN: 1.4.2_05 tiger-b46 tiger-beta2 VERIFIED IN: 1.4.2_05 tiger-beta2

EVALUATION This is a reasonable request for the suggested aliases (similar to those already provided for the EBCDIC encodings). ###@###.### 2001-08-22 Adding tiger to list of committed releases. ###@###.### 2004-03-18