UrlEncodedFormEntity(nameValuePairs) adds junk to parameter values

89 views Asked by At

Here is my code snippet:

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()));   

The above code adds some + (plus) signs to my parameter values wherever a ' '(space) is encountered. How can I avoid this?

0

There are 0 answers