docs: public static String getCharset(final String contentType) {
          // Default to UTF-8
          String charset = "UTF-8";
          try {
              // Content type is in the form:
              // Content-Type: text/html; charset=utf-8
              // Where they can be lots of params separated by ; characters
              if (contentType != null && !contentType.isEmpty()) {
                  if (contentType.contains(";")) {
                      String[] params = contentType.substring(contentType.indexOf(";")).split(";");
                      for (String param : params) {
                          param = param.trim();
                          if (param.indexOf("=") > 0) {
                              String paramName = param.substring(0, param.indexOf("=")).trim();
                              if ("charset".equals(paramName) && param.length() > (param.indexOf("=") + 1)) {
                                  String paramValue = param.substring(param.indexOf("=") + 1).trim();
                                  if (paramValue != null && !paramValue.isEmpty() && Charset.isSupported(paramValue)) {
                                      charset = paramValue;
                                      break;
                                  }
                              }
                          }
                      }
                  }
              }
          } catch (Throwable t) {
              // Ignore, we really don't want this util killing anything!
          }
          return charset;
      }