import org.apache.commons.codec.binary.Base64;

byte[] bytes = "I love my byte array".getBytes();
byte[] base64Bytes = Base64.encodeBase64( bytes );

System.out.println( new String( base64Bytes ) );
Outputs:

SSBsb3ZlIG15IGJ5dGUgYXJyYXk=

Good luck!  Like Roland said, "commons-codec.jar" is already on your
classpath.  The Base64 class is available for you to use.

yours,

Julius


On 12/6/06, Roland Weber <[EMAIL PROTECTED]> wrote:

Hello Marcelo,

it is not the same encoding used in URLs.
HttpClient does not have a Base64 encoder,
but it uses commons-codec for this purpose.

hope that helps,
  Roland

"Marcelo Chryssovergis" <[EMAIL PROTECTED]> wrote on 06.12.2006
15:16:46:

> Hello,
>
> I´m trying to login to a asp.net site.
>
> I´m using the postmethod to send the data, but one of the fields of
> the framework .Net (VIEWSTATE) has to be converted in a
> Base64String. I believe that´s the same encoding used in URLs.
>
> Is there any function in httpclient to encode the string to base64?
>
> Thanks,
> Marcelo





--
yours,

Julius Davies
416-652-0183
http://juliusdavies.ca/

Reply via email to