Loading

Updates to UrlEncode() AMPscript function

Julkaisupäivä: Jul 8, 2026
Kuvaus

As part of ongoing platform hardening, Marketing Cloud Engagement is updating how the AMPscript UrlEncode() function handles its input. After this change, UrlEncode() treats the text you give it as literal characters and encodes it for safe use in a URL. Any AMPscript expressions that appear inside the string being encoded are encoded as text rather than run. A small number of accounts that rely on the previous behavior are being contacted directly; if you have not been contacted, no action is required.

What is changing

Previously, in some cases UrlEncode() would evaluate AMPscript expressions embedded inside the string passed to it. Going forward, UrlEncode() encodes that text as-is. This makes the function's behavior predictable and consistent with its purpose: producing URL-safe text.

What you'll observe

If your content relied on the previous behavior, the change appears as a broken or incorrect link. In the rendered URL, the AMPscript expression itself shows up — the literal %%=...=%% or %%[...]%% text, or its percent-encoded form (for example, %25%25%3D…) — in place of the value it used to produce. If a link that previously worked now points somewhere unexpected or contains this literal text, this change is the likely cause.

Ratkaisu

How to tell if you are affected

You are affected only if you embed an executable AMPscript expression inside the string being passed to UrlEncode(). Review your emails, CloudPages, and content blocks for patterns like:

 

UrlEncode( ... "%%=SomeFunction()=%%" ... )

UrlEncode( ... %%[ ... ]%% ... )

 

where the %%=...=%% or %%[...]%% is part of the text being encoded.

 

The following common patterns are not affected and require no change

UrlEncode(@myVariable)

UrlEncode(%%FirstName%%)

UrlEncode(HTTPGet(...))

 

Passing a variable, a personalization string, or the result of a nested function all continue to work exactly as before.

Find affected content

To find every instance in your account, search your emails, CloudPages, and content blocks for UrlEncode( and check whether the text being encoded contains %%= or %%[. Those are the occurrences to update. Uses of UrlEncode( that pass a variable, a personalization string, or a nested function result need no change.

 

What to do if you are affected

Resolve the dynamic value before encoding it, then encode the resolved value:

 

Before:

%%=UrlEncode(Concat("/promo/", "%%=v(@segment)=%%"))=%%

 

After (recommended):

%%[ VAR @url SET @url = Concat("/promo/", v(@segment)) ]%%

%%=UrlEncode(@url)=%%

 

If you must assemble dynamic content inline, wrap it in TreatAsContent() immediately before encoding:

 

%%=UrlEncode(TreatAsContent("...dynamic content..."))=%%

 

After updating, test the affected message or page to confirm the URL renders as expected.

Availability

This change applies to Marketing Cloud Engagement. It does not affect Marketing Cloud Next.

Need help?

If you're unsure whether your content is affected, contact Salesforce Support and reference this article, or work with your account team.

Knowledge-artikkelin numero

005388674

 
Ladataan
Salesforce Help | Article