Hello Jaya, > 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.
Do not touch the Content-Type header. It's one of the things that's handled by HttpClient. Whatever you do to that header can only make things worse. > 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");); www-form-urlencoded is US-ASCII by definition. The only charset allowed in URLs is US-ASCII. It is pure luck (or tolerant behavior of libraries and servers) that it worked with Latin-1 at all. > // set the input parameters > Iterator it = paramList.keySet().iterator(); > while (it.hasNext()) { > String paramName = (String) it.next(); > postmethod.addParameter(paramName, > paramList.get(paramName)); > } If you need to support charsets, you can't use PostMethod.addParameter(). Use PostMethod.setRequestEntity() instead, with a MultiPartRequestEntity: http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.html You can set the HTTP_CONTENT_CHARSET parameter to UTF-8: http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html#HTTP_CONTENT_CHARSET hope that helps, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]