Solved! Go to Solution.
Hi, Can i get the same equivalent script for decoding a string.
Hi,
If your test project is JScript/Java Script/C#Script-based, then the code from https://scotch.io/tutorials/how-to-encode-and-decode-strings-with-base64-in-javascript can be used as it is.
For the project that uses some other language you can put the referenced code into Script Extension and use it from there.
Thanks, But i need the script in this format for decoding too
var string='test';
function main()
{
getEncodedValue(string);
}
function getEncodedValue(string)
{
var textBytes = dotNET.System_Text.Encoding.UTF8.GetBytes_2(string);
var encodedText = dotNET.System.Convert.ToBase64String(textBytes);
// return encodedText;
Log.Message(encodedText);
}
Hi,
The code I have referenced does not use .Net but is pure Java-based.
If you declare it as a public variable (as in the code sample), then use Base64.encode() to encode the string and Base64.decode() to decode encoded one.
Hey Alex,
I need a Function containing only Decoding part in java Script. I refered your Link Containing both encoding and decoding functions together and I'm not able to divide them seperately So can you help me with Seperate functions for both encoding and decode functionalities.
Regards,
Rohit Sen
Hi Rohit,
The referred link contains minified code (with extra spaces and indentations removed). You may expand it with the help of some Java Script formatter (or manually) and remove the part that you don't need.
P.S. Out of curiosity: is it really a problem if encoding function is present in the code?
Subject | Author | Latest Post |
---|---|---|