//: 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 charSets = Charset.availableCharsets(); Iterator it = charSets.keySet().iterator(); while(it.hasNext()) { String csName = it.next(); printnb(csName); Iterator aliases = charSets.get(csName).aliases().iterator(); if(aliases.hasNext()) printnb(": "); while(aliases.hasNext()) { printnb(aliases.next()); if(aliases.hasNext()) printnb(", "); } print(); } } } /* Output: Big5: csBig5 Big5-HKSCS: big5-hkscs, big5hk, big5-hkscs:unicode3.0, big5hkscs, Big5_HKSCS EUC-JP: eucjis, x-eucjp, csEUCPkdFmtjapanese, eucjp, Extended_UNIX_Code_Packed_Format_for_Japanese, x-euc-jp, euc_jp EUC-KR: ksc5601, 5601, ksc5601_1987, ksc_5601, ksc5601-1987, euc_kr, ks_c_5601-1987, euckr, csEUCKR GB18030: gb18030-2000 GB2312: gb2312-1980, gb2312, EUC_CN, gb2312-80, euc-cn, euccn, x-EUC-CN GBK: windows-936, CP936 ... *///:~