code: public String getCharset(String contentType) {
      String charSet = knownCharsets.get(contentType);
      if (charSet != null) {
        return charSet;
      }
  
      // Special cases
      if (contentType.startsWith("text/") || contentType.endsWith("+json") || contentType.endsWith("+xml")) {
        return "UTF-8";
      }
  
      return "BINARY";
    }
docs: Check which character set a given content-type corresponds to.
  @param contentType Content-type to check
  @return Charset the mimetype represents. "BINARY" if binary data.