Syntax

Platform.Function.URLEncode(value)
1 argument

Parameters

Name Type Required Description
value string Yes String to URL-encode

Examples

var email = "jane+test@example.com";
var encoded = Platform.Function.URLEncode(email);
Write(encoded); // "jane%2Btest%40example.com"

// Build a URL with encoded parameters
var redirectUrl = "/search?q=" + Platform.Function.URLEncode(searchQuery)
                + "&lang=" + Platform.Function.URLEncode(lang);
Platform.Response.Redirect(redirectUrl);

Notes

For more encoding options (e.g., encoding + signs differently), use the AMPscript URLEncode function with extra parameters via TreatAsContent:

Variable.SetValue("@val", myValue);
TreatAsContent("%%[Set @encoded = URLEncode(@val, 1, 1)]%%");
var encoded = Variable.GetValue("@encoded");

See Also

See Also