[SalesForce] How to URLencode a URL in ampscript

I am trying to set URL in my ampscript, but it changes the "?" in the url into "&". I tried to wrap the url between URLEncode("www.sample.com?12234")

Best Answer

According to documentation, you can choose multiple options on what an how to URL Encode your string. What you are looking for is probably this solution:

URLEncode('http://example.com?p=examplé',1,0)

This will only encode whatever is provided after ? - hence returning: http://example.com?p%3dexampl%c3%a9

Related Topic