code: public static String getDeclaredCharset(String contentType)
      {
          if (contentType == null)
          {
              return null;
          }
  
          Matcher matcher = CHARSET_PATT.matcher(contentType);
          if (matcher.find())
          {
              String encstr = matcher.group(1);
              return encstr;
          }
          else
          {
              return null;
          }
      }
docs: Get the actual string value declared as the charset in a content-type
  string, regardless of its validity.
  <p>
  NOTE: this is different from getCharset, which will always return a
  default value.
  </p>
  
  @param contentType
  the content-type string
  @return the verbatim charset declared or null if non-exists