0

Can we apply base 64 encoding in java and decode to get the same string using javascript ?

I need to do this to include three separate xml file in a single xml file, three of them being base64 encoded.

Acn
  • 1,010
  • 2
  • 11
  • 22

1 Answers1

0

Yes. You can use Base 64 encoding in multiple languages. See Decode Base64 data in Java

Community
  • 1
  • 1
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
  • if we encode the string "abcd" using java and send it to javascript, will the javascript get back the same string after decoding it ? – Acn Jan 16 '12 at 09:51
  • Yes. Base64 is implemented the same way. Encoding strings in Base64 makes no sense. Base64 is meant to encode binary data (e.g images) as text. – Piotr Gwiazda Jan 16 '12 at 14:06
  • True, however there's a case for encoding a string. eg if you are using json in your applications but you need to process external messages that are using a different format. – kimathie Nov 29 '21 at 05:29