You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Mathis Thomas (VTG)" <ma...@vtg.at> on 2003/01/15 10:11:18 UTC
POST method - Default content encoding
I think that the default encoding for a post should also be ISO-8859-1, is
that right?
With the latest nightly build I sent a post to a server with german umlauts
and these characters were endoded with UTF-8. I used following code:
....
PostMethod post = new PostMethod();
post.setHttp11( true );
post.setPath( "/samplepath" );
post.addParameter( "TXT", "Testtext: öäüÖÄÜß");
String s;
try {
//post.setRequestHeader( "Content-Type", "text/plain; charset=ISO-8859-1"
);
int ret = client.executeMethod( post );
s = post.getRequestBodyAsString();
System.out.println( "requestBody=" + s );
} catch (Exception ex ) {
ex.printStackTrace();
}
....
The output is :
requestBody=TXT=Testtext%3A%20%C3%B6%C3%A4%C3%BC%C3%96%C3%84%C3%9C%C3%9F
but schould be: requestBody=TXT=Testtext%3A%20%F6%E4%FC%D6%C4%DC%DF
Even if I use the outcommented line it does not change the output.
Thanks in advance,
Thomas
Re: POST method - Default content encoding
Posted by Oleg Kalnichevski <o....@dplanet.ch>.
Thomas
The bug should be fixed with one of the recent patches. Please let me
know if the problem persists
Cheers
Oleg
On Wed, 2003-01-15 at 10:11, Mathis Thomas (VTG) wrote:
> I think that the default encoding for a post should also be ISO-8859-1, is
> that right?
>
> With the latest nightly build I sent a post to a server with german umlauts
> and these characters were endoded with UTF-8. I used following code:
>
> ....
> PostMethod post = new PostMethod();
> post.setHttp11( true );
> post.setPath( "/samplepath" );
> post.addParameter( "TXT", "Testtext: öäüÖÄÜß");
> String s;
> try {
> //post.setRequestHeader( "Content-Type", "text/plain; charset=ISO-8859-1"
> );
> int ret = client.executeMethod( post );
> s = post.getRequestBodyAsString();
> System.out.println( "requestBody=" + s );
> } catch (Exception ex ) {
> ex.printStackTrace();
> }
> ....
>
> The output is :
> requestBody=TXT=Testtext%3A%20%C3%B6%C3%A4%C3%BC%C3%96%C3%84%C3%9C%C3%9F
> but schould be: requestBody=TXT=Testtext%3A%20%F6%E4%FC%D6%C4%DC%DF
> Even if I use the outcommented line it does not change the output.
>
> Thanks in advance,
> Thomas
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
Oleg Kalnichevski <o....@dplanet.ch>