Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. data_in – required argument. Sets a string to be encoded.

Example. Encode Dencode a Unicode string to Base64 then decode encode back and put to the debug log.

Code Block
var test = Base64EncodeWBase64Decode("test comment"); //the "test" variable will have value like "MAAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADMAOQA6ADQAMAA6AA0ACgB0AGUAcwB0ACAAMQANAAoAMAAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADQAMgA6ADIAMQA6AA0ACgB0AGUAcwB0ACAAMgA="MAAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADMAOQA6ADQAMAA6AA0ACgB0AGUAcwB0ACAAMQANAAoAMAAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADQAMgA6ADIAMQA6AA0ACgB0AGUAcwB0ACAAMgA=",true);
DebugLogString("----->"+test);
var res = Base64DecodeBase64EncodeW(test, true); // decode from Base64 to Unicode; if false, then 0 returned
DebugLogString("----->"+res); // the debug log shall say: "test comment"

If the Base64Decode method received the "true" parameter, the script will have the following output:

03-07-2019 15:39:40:
test 1
03-07-2019 15:42:21:
test 2