On Thu, 2011-01-27 at 01:03 +0100, Yanchuan Li wrote:
> Hello,
> I've been using httpclient v4.1 in my application. But so far I've searched
> for the whole week and couldn't find how to set encoding to UTF8 for all my
> post requests. I mean, we have got really a few documents there.
> Following is the code I've used to send a http post.
>
> DefaultHttpClient httpclient = new
> DefaultHttpClient();
> HttpPost httppost = new
> HttpPost(address);
> try {
>
> httpclient.setCookieStore(Forum_app.store);
>
> List<NameValuePair>
> nameValuePairs = new ArrayList<NameValuePair>(5);
> .
> .
> httppost.setEntity(new
> UrlEncodedFormEntity(nameValuePairs));
http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/entity/UrlEncodedFormEntity.html#UrlEncodedFormEntity%28java.util.List,%20java.lang.String%29
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]