hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yanchuan Li <m...@yanchuanli.com>
Subject set encodings for http post in httpclient v4.1
Date Thu, 27 Jan 2011 00:03:25 GMT
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 {
						List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
		                		httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
		               			 HttpResponse responseforurl = httpclient.execute(httppost);

Can anyone please show me how?

Thanks in advance.

Yanchuan Li
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message