hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: problem with posting cyrillic characters
Date Wed, 27 Oct 2004 15:46:31 GMT
Privet, Vasiliy

This is a fairly common problem. Make sure that you set the correct
charset attribute in the 'Content-Type' header. This should pretty much
do the trick

requestMethod.setRequestHeader(
  "Content-Type",
  "application/x-www-form-urlencoded; charset=KOI8-R");

For more details please refer to the HttpClient character encoding
guide:

http://jakarta.apache.org/commons/httpclient/charencodings.html

Cheers,

Oleg

On Wed, Oct 27, 2004 at 06:22:10PM +0300, Vasiliy Keretsman wrote:
> hi there!
> 
> I have got a problem with posting cyrillic character using
> http-client-2.0.2.
> 
> I receive somethig like "???? ?? ????" on server-side.
> 
> Could anyone help me?
> 
> Thank you.
> 
> here is bit of code :
> -----------------------
> 
>       try {
>           NameValuePair[] form_data = {new NameValuePair("param", "???????? ??????")};
>           requestMethod.setRequestBody(form_data);
> 
>           DefaultMethodRetryHandler retryhandler = new DefaultMethodRetryHandler();
>           retryhandler.setRequestSentRetryEnabled(false);
>           retryhandler.setRetryCount(3);
>           requestMethod.setMethodRetryHandler(retryhandler);
> 
>           // Execute the method.
>           int statusCode = client.executeMethod(requestMethod);
> 
>           System.out.println("STATUS CODE:"+ statusCode);
>           System.out.println("STATUS LINE:"+ requestMethod.getStatusLine());
>           if (statusCode == HttpStatus.SC_OK) {
>               System.out.println("Response Body:\n---\n" + requestMethod.getResponseBodyAsString());
>           }
>     }catch(Exception e){
>         e.printStackTrace();
>     } finally {
>           // Release the connection.
>           requestMethod.releaseConnection();
>    }
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> -- 
> Best regards,
>  Vasiliy                          mailto:vk@e-mobilink.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message