-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b51
-
generic
-
generic
Name: nl37777 Date: 04/23/2004
The program appended below can be used to obtain a list of
all character encodings that are supported by the J2RE through the
java.nio.charset API, with both their nio and io canonical names.
Comparing the list with the IANA charset registry at
http://www.iana.org/assignments/character-sets (which is referenced
from the Charset class specification) shows the following incorrect nio
canonical names:
IBM0858 should be IBM00858
IBM921 is not registered -> must start with "x-"
IBM949 is not registered -> must start with "x-"
x-IBM1047 should be IBM1047
x-IBM918 should be IBM918
Comparing the list with the J2SE 1.4.2 documentation at
http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html shows
the following incorrect io canonical names:
ISO-8859-15 should be ISO8859_15
windows-31j should be MS932
x-Big5-Solaris should be Big5_Solaris
x-IBM930 should be Cp930
x-IBM935 should be Cp935
x-IBM937 should be Cp937
x-IBM942 should be Cp942
x-IBM942c should be Cp942C
x-IBM943 should be Cp943
x-IBM943c should be Cp943C
x-IBM948 should be Cp948
x-IBM949C should be Cp949C
x-IBM950 should be Cp950
x-MS950-HKSCS should be MS950_HKSCS
x-windows-874 should be MS874
x-ISCII91 should be ISCII91
Big5-HKSCS should be Big5_HKSCS
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.Iterator;
public class GetAvailableCharsets {
public static void main (String[] args) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(new
byte[0]);
Iterator charsetIterator =
Charset.availableCharsets().keySet().iterator();
while (charsetIterator.hasNext()) {
String charsetName = (String) charsetIterator.next();
String langName = null;
try {
langName = (new InputStreamReader(stream,
charsetName)).getEncoding();
} catch (UnsupportedEncodingException e) {
}
System.out.println("nio name: " + charsetName + "; io name:
" + langName);
}
}
}
======================================================================
The program appended below can be used to obtain a list of
all character encodings that are supported by the J2RE through the
java.nio.charset API, with both their nio and io canonical names.
Comparing the list with the IANA charset registry at
http://www.iana.org/assignments/character-sets (which is referenced
from the Charset class specification) shows the following incorrect nio
canonical names:
IBM0858 should be IBM00858
IBM921 is not registered -> must start with "x-"
IBM949 is not registered -> must start with "x-"
x-IBM1047 should be IBM1047
x-IBM918 should be IBM918
Comparing the list with the J2SE 1.4.2 documentation at
http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html shows
the following incorrect io canonical names:
ISO-8859-15 should be ISO8859_15
windows-31j should be MS932
x-Big5-Solaris should be Big5_Solaris
x-IBM930 should be Cp930
x-IBM935 should be Cp935
x-IBM937 should be Cp937
x-IBM942 should be Cp942
x-IBM942c should be Cp942C
x-IBM943 should be Cp943
x-IBM943c should be Cp943C
x-IBM948 should be Cp948
x-IBM949C should be Cp949C
x-IBM950 should be Cp950
x-MS950-HKSCS should be MS950_HKSCS
x-windows-874 should be MS874
x-ISCII91 should be ISCII91
Big5-HKSCS should be Big5_HKSCS
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.Iterator;
public class GetAvailableCharsets {
public static void main (String[] args) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(new
byte[0]);
Iterator charsetIterator =
Charset.availableCharsets().keySet().iterator();
while (charsetIterator.hasNext()) {
String charsetName = (String) charsetIterator.next();
String langName = null;
try {
langName = (new InputStreamReader(stream,
charsetName)).getEncoding();
} catch (UnsupportedEncodingException e) {
}
System.out.println("nio name: " + charsetName + "; io name:
" + langName);
}
}
}
======================================================================