code: private String getContentCharSet(final HttpEntity entity) throws ParseException {
          if (entity == null) {
              return null;
          }
          String charset = null;
          if (entity.getContentType() != null) {
              HeaderElement values[] = entity.getContentType().getElements();
              if (values.length > 0) {
                  NameValuePair param = values[0].getParameterByName("charset");
                  if (param != null) {
                      charset = param.getValue();
                  }
              }
          }        
          return charset;
      }
docs: Get the charset used to encode the http entity.