1

Is there a way to URLdecode a URL Param with AMPscript? I am passing form data (with enctype="application/x-www-form-urlencoded") into landing page that should then decode the data and then write to DE. Can this be accomplish with only AMPscript?

  • can you post the code here? – Abhishek May 27 '17 at 7:32
1

decodeURI() and decodeURIComponent() are JavaScript functions - not AMPScript. It's hard to tell but it looks like you're working in content builder as apposed to in cloud pages. Is that correct? You cannot save JavaScript in content builder, and also you cannot use JavaScript in an email just in case that's what you're after.

Here is an example of SSJS employing decodeURI Source: enter image description here

Result: enter image description here

  • Ahh I see, I might have tried doing it wrong then. I was actually operating within a cloud page, but everything was inside an AMP script, i.e. no JavaScript Scripts. Is it possible to get access to a decoding function within AMPscript? The cloudpage really only serves as an endpoint to get Data into Salesforce (its not supposed to show anything). I was testing within an email, that is correct, but the functionality is supposed to go into a cloud page. – Fabian Bosler Dec 23 '18 at 10:54
1

Encode on the landing page or email:

%%[
      SET @queryStringPart2 = EncryptSymmetric("USE_ENCRYPTION_OF_CHOICE",  &emailAddress=test@test.com&id=123", "etcetera")
      SET @newLink = Concat("http://pages.exacttarget.com/page.aspx?QS=773ed3059447707d9cf0f7f1ffa7a5cc", "&encrypted=", @queryStringPart2)
]%%

Then decode on the landing page:

%%[
    SET @qsPart2 = QueryParameter("encrypted") /* gets the encrypted string */)
    SET @DecryptedString = DecryptSymmetric("DECRYPTION_OF_CHOICE", @qsPart2)
/* Use Substring or regex to parse the decrypted string */

]%%

Hope this helps!

0

I do not think there is a decode equivalent, but I would use javascript function decodeURIComponent() (inside a freeform or html block) and then assign the value to the landing page field. If you can post your code example, it will be easier to suggest a solution.

  • When trying to test this, I get The subscriber preview failed to generate. Review the details, correct all issues, and try again. An unrecognized expression appears in a script block. Script Expression: decodeURIComponent any idea how I could get the decoding to work? – Fabian Bosler Nov 19 '18 at 11:56
  • @FabianBosler Can you please post a screen shot of the error and the window with the error? – Yosef Sahler Dec 12 '18 at 2:53
  • see in next "answer" – Fabian Bosler Dec 17 '18 at 18:32
  • decodeURIComponent() is a JavaScript function - not AMPScript. It' – Yosef Sahler Dec 19 '18 at 1:44
0

So this is not really an answer, but the only way for me to post a screenshot:

and a second one with the actual email: this produces an error

Frankly I am not even sure, if this is the right approach, but we get stuff like this in Salesforce "D�sseldorf" and the Data comes through a webform -> webhook -> cloudpage. And I am not quite sure where in our connection the special characters get scrambled up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.