Java - List all character sets supported by a JVM

Description

List all character sets supported by a JVM

Demo

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

public class Main {
  public static void main(String[] args) {
    Map<String, Charset> map = Charset.availableCharsets();
    Set<String> keys = map.keySet();
    System.out.println("Available Character Set Count: " + keys.size());

    for (String charsetName : keys) {
      System.out.println(charsetName);
    }/*from  w  w w . j a  va  2 s.co m*/
  }
}

Result

Related Topic