code: public static Charset getCharset(HttpMessage message, Charset defaultCharset) {
          CharSequence contentTypeValue = message.headers().get(HttpHeaderNames.CONTENT_TYPE);
          if (contentTypeValue != null) {
              return getCharset(contentTypeValue, defaultCharset);
          } else {
              return defaultCharset;
          }
      }
docs: Fetch charset from message's Content-Type header.
  
  @param message        entity to fetch Content-Type header from
  @param defaultCharset result to use in case of empty, incorrect or doesn't contain required part header value
  @return the charset from message's Content-Type header or {@code defaultCharset}
  if charset is not presented or unparsable