I want to use php to pass and get a encoded string to other system which are using java.util.Base64
to encode and decode.
Can I use base64_encode($str)
to encode and pass the string to them for decode in php and
can i use base62_decode($str)
to decode what I get from java.util.Base64
in php?
Or is there other way to encode and decode java.util.Base64
string in php?
Thanks!!
Short Answer: Yes.
Base64 is a standard.
Long Answer:
The PHP documentation for base64_encode references RFC 2045 which is the MIME base64 encoding.
The Javadoc tells that Java supports different types of Base64, one of which is MIME. The Basic type should also work. The main difference is that the MIME type requires that no line is longer than 76 characters.
Yes, base64 is a standard that should work the same on all platforms.
Of course, a standard format across different platform and language.