The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.nio.charset  [2 examples]

e185. Listing All Available Unicode to Character Set Converters

    Map map = Charset.availableCharsets();
    Iterator it = map.keySet().iterator();
    while (it.hasNext()) {
        // Get charset name
        String charsetName = (String)it.next();
    
        // Get charset
        Charset charset = Charset.forName(charsetName);
    }
Here's a sample of the output:
    ISO-8859-1
    ISO-8859-15
    US-ASCII
    UTF-16
    UTF-16BE
    UTF-16LE
    UTF-8
    windows-1252

 Related Examples
e186. Converting Between Strings (Unicode) and Other Character Set Encodings


© 2002 Addison-Wesley.