Hi
I am using Apache's HttpClient 3.0 and was noticing the following
When I set the content header on the post method I am not able to parse the
parameters on the backend i.e request.getParameters returns null.
I am currently sending Latin-1 characters but we need to make it UTF-8
compliant. Basically my question is how do I change the charset for the request
body?
Here's what I am doing right now that doesn't work:
// Create a method instance.
PostMethod postmethod= new PostMethod(url);
postmethod.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=utf-8"););
// set the input parameters
Iterator it = paramList.keySet().iterator();
while (it.hasNext()) {
String paramName = (String) it.next();
postmethod.addParameter(paramName, paramList.get(paramName));
}
try {
HttpClient client = new HttpClient();
// Execute the method.
client.executeMethod(postmethod);
} catch (HttpException e) {
...
} catch (IOException e) {
....
} finally {
// Release the connection.
method.releaseConnection();
}
Thanks
Jaya