hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: PostMethod - parameter in BASE64String
Date Wed, 06 Dec 2006 17:03:46 GMT
Hi Julis, Marcelo,

> Here's an example "URL-Encoder" in Java:
> 
> char c = ...  // character to encode
> switch ( c ) {
>  case ' ':
>    buf.append( '+' );
>    break;
>  case '$':
>  case '<':
>  case '>':
>  case '&':
>  case '+':
>  case ',':
>  case '/':
>  case ':':
>  case ';':
>  case '=':
>  case '?':
>  case '@':
>  case '#':
>  case '%':
>    buf.append( '%' );
>    buf.append( Integer.toHexString( c ) );
>    break;
>  default:
>    buf.append( c );
>    break;
> }

Or else you just use org.apache.commons.codec.net.URLCodec,
like our EncodingUtil class does. No need to duplicate code,
you've got a dependency on commons-codec anyway.

cheers,
  Roland

---------------------------------------------------------------------
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