commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Priti Menon" <pri...@cybage.com>
Subject Base64 encoding problem
Date Wed, 14 Jun 2006 07:09:06 GMT
Hi All,

I am facing a problem with the Base64 encoding class in the commons package.
i.e. org.apache.commons.codec.binary.Base64

I am trying to encode & decode a string back to its original value. I have
tried this on windows & linux.
If you compare the hashcodes of the original string with the new string, it
returns different values with Linux.

For eg.
String s = "Matrix ";
System.out.println("s = " + s.hashCode());
String s1 = new String(Base64.encodeBase64(s.getBytes()));
String decodedString = new String(Base64.decodeBase64(s1.getBytes()));
System.out.println("decodedString = " + decodedString.hashCode());

The output on windows :-
s = Matrix 
s = -1789003553
decodedString = -1789003553

The output on linux :-
s = Matrix?
s = -1789003553
decodedString = -1789003650

Has anyone faced this problem before ?

Thanks & Regards,
Priti

PS. There is a special character in the string after the word 'Matrix'.


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


Mime
View raw message