code: public Charset contentCharset() {
          String ct = contentType();
          if (ct != null) {
              int index = ct.indexOf("charset=");
              if (index != -1) {
                  return Charset.forName(ct.substring(index + 8));
              } else {
                  return null;
              }
          } else {
              return null;
          }
      }
docs: Retrieves the charset part of the content-type header. For instance on {@code Content-Type: text/html;
  charset=ISO-8859-4}, it retrieves {@code ISO-8859-4}.
  
  @return the charset of the content-type header, {@code null} if not set.