Url decoding in Freemarker

730 views
Skip to first unread message

Nicolas Triballier

unread,
Jul 31, 2013, 11:01:00 AM7/31/13
to suppor...@runmyprocess.com
Hello!

I've got a URI encoded string (for example, "I%20am%20saving%20this%20to%20edit") in a process object, "ecr.changeDescription", that I want to decode and display in an email from a manual task.

I can't find any Freemarker URI decode functions, so I have been trying to do it with embedded JS in Freemarker like this:
<#assign tmp = ${ecr.changeDescription}>
<@script env="javascript">
setVariable("decodedChangeDescription", decodeURIComponent(tmp));
</@script>
${decodedChangeDescription}

But I can't seem to find the right sequence of commands.  I.e., I keep getting errors.

Is there a better way to do this?

Thanks for any help.

Michael

Nicolas Triballier

unread,
Jul 31, 2013, 12:11:59 PM7/31/13
to
Hi Michael,

you're right there's a js function for this.

Keep in mind : in the process, a script must ONLY use freemarker or JS, do never mix <@script> and ${}

See the right script below:

ttyl

Nicolas
Reply all
Reply to author
Forward
0 new messages