Javascript print function auto decoding encodes strings using endodeURIComponent

I am creating an URL as a response in a Message node using Javascript. I use something like -

var url = “htp://xyz” + “?query=” + “ABC WHEN X=Y” ;
var encodedUrl = encodedURIComponent(url) ;
print("<a href="" + encodedUrl + “” > Click Here <\a>"):

When I run Preview, I see the perfect encoding with the “=” in “WHEN X=Y” replaced by $3D.
However, when this runs in the bot, somehow %3D gets decoded back to “=” and this breaks the URL.
How can I resolve this?

@bhawmik
Try to store the URL in any variable like:

var context.urlStr = “htp://xyz” + “?query=” + “ABC WHEN X=Y” ;
var encodedUrl = encodedURIComponent(url) ;
var context.encodedURL = encodedUrl;

Try using a plain text response formatted as below

[Click me]({{context.encodedURL}})

Hope this helps.

Thanks. I’ll give it a try, although I found some workarounds.