public Charset charset() {

    Collection<String> contentTypeHeaders = headers().get("Content-Type");

    if (contentTypeHeaders != null) {
      for (String contentTypeHeader : contentTypeHeaders) {
        String[] contentTypeParmeters = contentTypeHeader.split(";");
        if (contentTypeParmeters.length > 1) {
          String[] charsetParts = contentTypeParmeters[1].split("=");
          if (charsetParts.length == 2 && "charset".equalsIgnoreCase(charsetParts[0].trim())) {
            String charsetString = charsetParts[1].replaceAll("\"", "");
            return Charset.forName(charsetString);
          }
        }
      }
    }

    return Util.UTF_8;
  }
Returns a charset object based on the requests content type. Defaults to UTF-8 See <a
href="https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.3">rfc7231 - Accept-Charset</a>
See <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.1">rfc7231 - Media
Type</a>
core/src/main/java/feign/Response.java