code: @FFDCIgnore({IllegalCharsetNameException.class, UnsupportedCharsetException.class})
      public static String mapCharset(String enc, String deflt) {
          if (enc == null) {
              return deflt;
          }
          //older versions of tomcat don't properly parse ContentType headers with stuff
          //after charset=StandardCharsets.UTF_8
          int idx = enc.indexOf(";");
          if (idx != -1) {
              enc = enc.substring(0, idx);
          }
          // Charsets can be quoted. But it's quite certain that they can't have escaped quoted or
          // anything like that.
          enc = charsetPattern.matcher(enc).replaceAll("").trim();
          if ("".equals(enc)) {
              return deflt;
          }
          String newenc = encodings.get(enc);
          if (newenc == null) {
              try {
                  newenc = Charset.forName(enc).name();
              } catch (IllegalCharsetNameException icne) {
                  return null;
              } catch (UnsupportedCharsetException uce) {
                  return null;
              }
              String tmpenc = encodings.putIfAbsent(enc, newenc);
              if (tmpenc != null) {
                  newenc = tmpenc;
              }
          }
          return newenc;
      }
docs: into something that is actually supported by Java and the Stax parsers and such.