/**
  * Constructs a new {@link UrlEncodedFormEntity} with the list of parameters in the specified
  * encoding.
  *
  * @param parameters list of name/value pairs
  * @param charset encoding the name/value pairs be encoded with
  * @throws UnsupportedEncodingException if the encoding isn't supported
  */
 public UrlEncodedFormEntity(final List<? extends NameValuePair> parameters, final String charset)
     throws UnsupportedEncodingException {
   super(
       URLEncodedUtils.format(
           parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET.name()),
       ContentType.create(URLEncodedUtils.CONTENT_TYPE, charset));
 }
Exemple #2
0
 /**
  * Obtains value of the {@link CoreProtocolPNames#HTTP_CONTENT_CHARSET} parameter. If not set,
  * defaults to <code>ISO-8859-1</code>.
  *
  * @param params HTTP parameters.
  * @return HTTP content charset.
  */
 public static String getContentCharset(final HttpParams params) {
   Args.notNull(params, "HTTP parameters");
   String charset = (String) params.getParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET);
   if (charset == null) {
     charset = HTTP.DEF_CONTENT_CHARSET.name();
   }
   return charset;
 }