Question

Base64 encoding in Pega 6

Hi,

We need to encode some JS variables such as var attachmentid into base 64. the function window.btoa(data) does not seem to work. could we have alternative for same in pega 6 (jdk 1.6) please ?

Comments

Keep up to date on this post and subscribe to comments

Pega
July 12, 2019 - 12:02am

Hi,

<% String attachmentid="12345678" String encodedvalue=pega_rules_default.Base64Encode(attachmentid);%>

<script>

function testing(){

var jsvalue="<% =attachmentid %>";

var jsencodedvalue ="<%=encodedvalue%>";

 

}

</script>

converts the js variable value to base64 encoding. call the testing function and put a debugger in the code it will converts the js variable value to base64 encoding