code: public static Charset getCharset(MediaType m) {
          String name = (m == null) ? null : m.getParameters().get(MediaType.CHARSET_PARAMETER);
          try {
              return (name == null) ? Charsets.UTF_8 : Charset.forName(name);
          } catch (Exception e) {
              return Charsets.UTF_8;
          }
      }
docs: <p>getCharset.</p>
  
  @param m a {@link javax.ws.rs.core.MediaType} object.
  @return a {@link java.nio.charset.Charset} object.