I've solved this problem (Spanish Characters ) with
private static final String CHARSET="ISO-8859-15";
try{
org.apache.commons.httpclient.URI.setDefaultProtocolCharset(CHARSET);
}catch(org.apache.commons.httpclient.URI.DefaultCharsetChanged dcc){
// CASE 1: the exception could be ignored, when it is set by user
if (dcc.getReasonCode() == URI.DefaultCharsetChanged.PROTOCOL_CHARSET)
{
// CASE 2: let user know the default protocol charset changed
log.warn("Default Protocol Charset Changed to "+CHARSET);
}
}
-----Mensaje original-----
De: Martin Schnyder [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 10 de julio de 2003 16:23
Para: [EMAIL PROTECTED]
Asunto: Encoding of special characters in request URI
When I use the GetMethod class to send text with special characters (German
Umlaute "���") in the request parameters, the special characters are not
encoded correctly. This happens when I use method
HttpMethodBase.setQueryString(NameValuePair[] params)
to set the query parameters.
I saw that Release 2.0 Beta 2 fixed that with bug fix 20481. Special
characters are now encoded differently but still wrong, as far as I can see.
Method HttpMethodBase.setQueryString(NameValuePair[]) calls
formUrlEncode(params, HttpConstants.HTTP_ELEMENT_CHARSET) to encode the
parameters. The value of HTTP_ELEMENT_CHARSET is US-ASCII. When I change the
charset to HttpConstants.DEFAULT_CONTENT_CHARSET (which is ISO-8859-1), the
German "Umlaute" are encoded correctly. I checked that with the code in CVS
HEAD. Is this a bug or should really only the US-ASCII characters be
supported in a request URI?
Regards,
Martin Schnyder
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]