as part of:
String.getBytes(String charset)
you cannot use "ISO-2022-CN" which is a valid MIME charset name. Even though Java supports the charset. The JDK has a different name for it, "ISO2022CN".
An alias for it needs to be added to sun.io.CharacterEncoding:
just add the line:
aliasTable.put("iso-2022-cn", "ISO2022CN");
===========
The same goes for "ISO-2022-KR". Need the following line for that one:
aliasTable.put("iso-2022-kr", "ISO2022KR");
===========
The same goes for "UTF-8". Need the following line for that one:
aliasTable.put("utf-8", "UTF8");
aliasTable.put("utf8", "UTF8");
you need the second one in case someone uses a lower case "utf8" it will not find the correct one.