code: public static String getJavaEncodingForMysqlCharset(String mysqlCharsetName, String javaEncoding) {
          String res = javaEncoding;
          MysqlCharset cs = CHARSET_NAME_TO_CHARSET.get(mysqlCharsetName);
          if (cs != null) {
              res = cs.getMatchingJavaEncoding(javaEncoding);
          }
          return res;
      }
docs: MySQL charset could map to several Java encodings.
  So here we choose the one according to next rules:
  if there is no static mapping for this charset then return javaEncoding value as is because this
  could be a custom charset for example
  if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available
  for this mapping then javaEncoding value as is; this is required when result should match to connection encoding, for example if connection encoding is
  Cp943 we must avoid getting SHIFT_JIS for sjis mysql charset
  if static mapping exists and javaEncoding doesn't match any Java encoding canonical
  names or aliases available for this mapping then return default Java encoding (the first in mapping list)
  
  @param mysqlCharsetName String
  @param javaEncoding String
  @return String