Apostrophe in Macro

Jon White asked on November 6, 2019 11:49

Hi all,

I'm trying to use a macro to show a name from a custom field from a page type. I then want to use this within a URL for an XML feed so it can generate a list of their publications automatically when you click on someone's profile.

An example would be like below (although not actual website): http://examplesite.com/publications/user={% CurrentDocument.GetValue("Name") #%}.xml

This works fine for 99% of the names, except I have a name with an apostrophe which breaks the URL and doesn't work. I was hoping to do a .replace() on the apostrophe to replace with a valid character that is accepted in the url but this doesn't work. I'm of the understanding that it is a special character but is there anything I can do to fix this or is this a no go?

Sorry, my knowledge on this is limited so apologies if what I'm doing is wrong.

Thanks, Jon

Correct Answer

Saul Sheehan answered on November 6, 2019 12:30

could you not URL encode it?

0 votesVote for this answer Unmark Correct answer

Recent Answers

Jon White answered on November 6, 2019 12:56

Thank you! duh I should've thought of that!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.