I have to decode a base64 encoded data received from a PHP server.
The server uses 'base64_encode' to encode the data.
In my Android app, I use android.utils.Base64 class to do the decoding.
original encrypted data = "†+Ü]M(‡=ñö"
Base64 encoding data in PHP gives - "hisP3F1NBCgIAocQCD3x9g=="
Base64 encoding data in Android gives - "4oCgKw/DnF1NBCgIAuKAoRAIPcOxw7Y="
As you can see, the Java encoded string is longer than the PHP encoded string. I need to find out their default encoding formats.
How to get the same encoded string from both?
Java/Android code :
String encrypted = "†+Ü]M(‡=ñö";
byte[] encoded = Base64.encode(encrypted.getBytes(), Base64.DEFAULT);
String str = new String(encoded); //str = "4oCgKw/DnF1NBCgIAuKAoRAIPcOxw7Y="