You need to sign in to do that
Don't have an account?
Encoding and decoding in Apex
Is anyone help to get the output for Below code? Some Encoding and decoding problem in my data.
My output::
/SMS/Homepage
My code:
String url = 'https://developer-edition.na9.force.com/MMMS/sitelogin?goto=%2Fapex%2FUnauthorized%3FstartURL%3D%252FSMS%252FHomepage';
System.debug(':::::::::url::::'+url);
url = url.substringAfter('startURL');
String encoded = EncodingUtil.urlEncode(url, 'UTF-8');
System.debug(':::::::::encodedData::::::::::'+encoded);
String decoded = EncodingUtil.urlDecode(encoded, 'UTF-8');
System.debug(':::::::::decodeddata::::::::::'+decoded);
::::::::url::::https://developer-edition.na9.force.com/MMMS/sitelogin?goto=%2Fapex%2FUnauthorized%3FstartURL%3D%252FSMS%252FHomepage
:::::::::encodedData::::::::::%253D%25252FSMS%25252FHomepage
::::::::decodeddata::::::::::%3D%252FSMS%252FHomepage
Yo should follow the folowing pattern:
Encryption: Start Field > Blob.valueOf > Encrypt > encode > End Field
Decryption: End Field > decode > Decrypt > Blob.toString > Start Field
For example:
Its not working.I am getting the same output.Its not encrypted.Its didn't remove the %2F