commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [httpclient] How to send and recieve Serialized Object using Http Client
Date Wed, 09 Feb 2005 01:28:06 GMT
On Tue, 2005-02-08 at 17:49 -0700, Wendy Smoak wrote:
> From: "Sanjeev Tripathi" <>
> > Can any one give me url for getting Base64OutputStream and
> > Base64InputStream classes on google.
> Did you see the reply on commons-user earlier today?  (You're still posting
> to the 'dev' list.)  Matt Goodwin posted code that gets you from an object
> to a base 64 encoded byte[].
> You can see his message in the archives here:

Hi Sanjeev,

It looks to me like you are trying to encode a *String* containing a
password. In this case, you don't want to "serialize an object" (as
described in Matt's email), but instead use:

   byte[] passwordAsBytes = password.getBytes(encodingName);

You will need to make sure you use an encoding which the receiver of the
encoded password expects. Normally, "ISO-8859-1" (aka "ISO-LATIN-1") is
the best choice but if passwords are in chinese/japanese/hindi/etc then
you will need to think more carefully about the encoding you use.

If you're planning to store the password in a database or similar, and
later read it back into a java app, then the encoding you use just has
to be the same as the one you use after decoding the password to convert
the decoded byte[] array back to a String.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message