Listing All Available Unicode to Character Set Converters - Java Internationalization

Java examples for Internationalization:Charset

Description

Listing All Available Unicode to Character Set Converters

Demo Code

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;

public class Main {
  public static void main(String[] argv) throws Exception {
    Map map = Charset.availableCharsets();
    Iterator it = map.keySet().iterator();
    while (it.hasNext()) {
      // Get charset name
      String charsetName = (String) it.next();
      System.out.println(charsetName);
      // Get charset
      Charset charset = Charset.forName(charsetName);
    }//www  .j  a  v  a  2 s.c  o  m

  }
}

Result


Related Tutorials