Android HttpPost - 在cp1251中发送请求

时间:2012-02-21 21:41:16

标签: android http utf-8 http-post cp1251

我使用以下代码发送请求:

final DefaultHttpClient client = new DefaultHttpClient();
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("number", pNumber));
final HttpPost httpPost = new HttpPost(URL_MAIN);
httpPost.setEntity(new UrlEncodedFormEntity(pairs));
client.execute(httpPost);

它以UTF-8发送请求,但我需要cp1251(站点仅适用于此CP)。如何将其编码到cp1251中?

0 个答案:

没有答案