Bug 22850 - java.nio.charset.Charset: case-sensitive, aliases missing
Summary: java.nio.charset.Charset: case-sensitive, aliases missing
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-26 14:42 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2005-01-26 14:42:25 UTC
I consider case-sensitivity a bug, dunno about
missing aliases.  As they are for convinience, the
more the better?


-----------------------------
java: Blackdown 1.4.2-01
jamvm-cvs: jamvm 1.2.4 + classpath CVS

$ java Test
utf-8 = true
utf8 = true
iso-8859-1 = true
latin1 = true
UTF-8 = true
UTF8 = true
ISO-8859-1 = true
LATIN1 = true

$ jamvm-cvs Test
utf-8 = false
utf8 = false
iso-8859-1 = false
latin1 = false
UTF-8 = true
UTF8 = false
ISO-8859-1 = true
LATIN1 = false
$

--------------------------------

import java.nio.charset.Charset;
public class Test {
    static String [] list = {
        "utf-8", "utf8", "iso-8859-1", "latin1",
        "UTF-8", "UTF8", "ISO-8859-1", "LATIN1",
    };
    public static void main(String [] args) {
        for (int i = 0; i < list.length; i++) {
            String cs = list[i];
            System.out.println(cs + " = " + Charset.isSupported(cs));
        }
    }
}
Comment 1 from-classpath 2005-02-04 15:09:54 UTC
The mauve test for this is/will be gnu.testlet.java.nio.charset.Charset.forName2

It checks the availability of of certain charsets using case-insensitive names.

A couple of them will fail on JDK <= 1.5.



public void test(TestHarness h) {
		/*
		 * Check for standard encodings using case-insensitive and alternative
		 * names.
		 */

		// IANA name for UTF-8
		checkCharset(h, "uTf-8");

		// UTF-8 names from
		// http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
		checkCharset(h, "utf8");

		checkCharset(h, "UtF-16bE");
		checkCharset(h, "uTf-16Le");

		// IANA names for 8859_1
		checkCharset(h, "IsO-iR-100");
		checkCharset(h, "iSo_8859-1");
		checkCharset(h, "LATIN1");
		checkCharset(h, "L1");
		checkCharset(h, "IbM819");
		checkCharset(h, "cp819");
		checkCharset(h, "CSisolATIN1");

		// IANA names for US-ASCII
		checkCharset(h, "iSo-Ir-6");
		checkCharset(h, "AnSi_X3.4-1986");
		checkCharset(h, "IsO_646.IRV:1991");
		checkCharset(h, "AsCiI");
		checkCharset(h, "IsO646-us");
		checkCharset(h, "Us");
		checkCharset(h, "IbM367");
		checkCharset(h, "cP367");
		checkCharset(h, "CSASCII");

		// UTF-8 names from
		// http://oss.software.ibm.com/cgi-bin/icu/convexp?s=ALL
		/* These fail on official implementation of <= 1.5 */
		checkCharset(h, "ibm-1208");
		checkCharset(h, "ibm-1209");
		checkCharset(h, "ibm-5304");
		checkCharset(h, "ibm-5305");
		checkCharset(h, "windows-65001");
		checkCharset(h, "cp1208");
	}
Comment 2 from-classpath 2005-04-15 12:48:07 UTC
Forgot to mark this as fixed.