这是我的代码段:
HttpClient client = new DefaultHttpClient();
String urlStr = FolderManager.ApplicationUnderTestUrl();
HttpPost post = new HttpPost(urlStr);
List<BasicNameValuePair> nameValuePairs = new ArrayList<BasicNameValuePair>(1);
if ((paramName != null ) && (paramVal != null))
{
for (int i = 0; i < paramName.length; i++)
{
nameValuePairs.add(new BasicNameValuePair(paramName[i], paramVal[i]));
}
}
post.setEntity(new UrlEncodedFormEntity(nameValuePairs ,"UTF-8"));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
上面的代码在我的参数值中添加了一些+(加号)符号,无论在哪里&#39;遇到了#(空格)。我怎么能避免这个?