[SalesForce] URLEncode challenge in ExactTarget AMPscript Landing Page

I'm trying to add specific project info into URL's in an AMPscript driven database system. In doing so I've tried using the URLEncode() function as described here. Trouble is that it doesn't appear to be encoding the spaces as %20 as I'd expect. In fact, it's simply leaving the spaces in the URL as spaces. This doesn't seem to interfere with the Anchor tags but I'm concerned in some ways it could. I've tried two methods. One is to add the product name to the URL which is using a GUID code to actually develop the landing page content. The url might be pages.info.bentley.com/database/?guid=jhgd-yuio-etc.&name=should have no spaces

I've tried to only urlencode the @NAME variable as

SET @EncodeName = URLEncode(@Name)

http://pages.info.bentley.com/product/?GUID=%%=v(@GUID)=%%&name=%%=v(@EncodeName)=%%

and I've also tried to URLEncode the whole link within the landing page. as: %%=URLEncode(http://pages.info.bentley.com/product/?GUID=%%=v(@GUID)=%%&name=%%=v(@Name)=%%)=%%. The second variation (Encode the whole address) is delivering an error message indicating I have no closing parenthesis (which seems untrue) and the top one (encoding just the name parameter) draws the name but spaces remain as spaces. I've tried adding the optional parameter of a 0, or a 1 to force it to react but same results.

Best Answer

Try this way

%%=URLEncode(concat('http://pages.info.bentley.com/product/?GUID=', @GUID, '&name=', @Name)) =%%

The extra percent signs and v() aren't required.

Related Topic