OnJava8-Examples/io/AvailableCharSets.java

35 lines
1.1 KiB
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: io/AvailableCharSets.java
// Displays Charsets and aliases
import java.nio.charset.*;
import java.util.*;
import static net.mindview.util.Print.*;
public class AvailableCharSets {
public static void main(String[] args) {
SortedMap<String,Charset> charSets =
Charset.availableCharsets();
2015-05-27 23:30:19 -07:00
for(String csName : charSets.keySet()) {
2015-04-20 15:36:01 -07:00
printnb(csName);
2015-05-27 23:30:19 -07:00
Iterator aliases = charSets.get(csName)
.aliases().iterator();
2015-04-20 15:36:01 -07:00
if(aliases.hasNext())
printnb(": ");
while(aliases.hasNext()) {
printnb(aliases.next());
if(aliases.hasNext())
printnb(", ");
}
print();
}
}
2015-05-18 23:05:20 -07:00
} /* Output: (First 7 Lines)
2015-04-20 15:36:01 -07:00
Big5: csBig5
2015-05-05 11:20:13 -07:00
Big5-HKSCS: big5-hkscs:unicode3.0, Big5_HKSCS, big5-hkscs, big5hkscs, big5hk
EUC-JP: eucjis, Extended_UNIX_Code_Packed_Format_for_Japanese, x-eucjp, eucjp, csEUCPkdFmtjapanese, euc_jp, x-euc-jp
EUC-KR: 5601, ksc5601-1987, ksc5601_1987, euckr, ksc5601, ksc_5601, ks_c_5601-1987, euc_kr, csEUCKR
2015-04-20 15:36:01 -07:00
GB18030: gb18030-2000
2015-05-05 11:20:13 -07:00
GB2312: euc-cn, x-EUC-CN, gb2312-1980, gb2312, gb2312-80, euccn, EUC_CN
GBK: CP936, windows-936
2015-04-20 15:36:01 -07:00
...
*///:~