Here you can find the source of getCanonicalCharset(String charset)
public static String getCanonicalCharset(String charset) throws UnsupportedEncodingException
//package com.java2s; //License from project: Apache License import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; public class Main { private static final OutputStream DUMMY_OUTPUT_STREAM = new ByteArrayOutputStream(0); public static String getCanonicalCharset(String charset) throws UnsupportedEncodingException { return new OutputStreamWriter(DUMMY_OUTPUT_STREAM, charset).getEncoding(); }//from www . j a va2s. c om }