On Mon, 2008-06-09 at 18:51 +0200, Bas Schulte wrote:
> Hi,
> 
> I need to encode my parameters in a GET request to a given host in  
> iso-8859-1. How would I go about that with httpclient (3.1)?
> 
> There's EncodingUtil.getBytes that gives me a byte[]:
> 
> String messageData = "blah";
> 
> byte[] bytes = EncodingUtil.getBytes(messageData, "iso-8859-1");
> 
> How do I feed that byte[] properly to create a NameValuePair that I  
> can feed to setQueryString, like so:
> 
> get.setQueryString(new NameValuePair[]{new NameValuePair("data", ???),
> 

get.setQueryString(
EncodingUtil.formUrlEncode(
  new NameValuePair[] {
    new NameValuePair("data", "blah")}, "iso-8859-1"));

Hope this helps

Oleg


> Any pointers how to solve this (may not even be specific to  
> httpclient, just never stumbled upon this in java)?
> 
> Thanks,
> 
> bas.
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to