Support Article
Base64Encode and Base64Decode are not inverse functions
SA-78788
Summary
The @Base64Decode(@Base64Encode(param.inputStr)) returns null for a string in the attachment.
Error Messages
Not Applicable
Steps to Reproduce
- Use the attached document to obtain the string.
- Execute a simple activity with Encode-Decode.
Root Cause
A defect in Pegasystems’ code or rules: Pega's Base64 API.
Resolution
Perform the folloiwng local-change:
Use java.util.Base64 library in the Rule Utility Functions (RUF) instead of Pega's Base64.
For Encoding - new String(java.util.Base64.getEncoder().encode(nonFormatted.getBytes()))
For Decoding - new String(java.util.Base64.getDecoder().decode(encodedString.getBytes()))
Published December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.