Handlebars Helper Function: encodeURIComponent
Encodes non-URL components of a string.
This function encodes only characters that follow a URL, such as a query string. To encode an entire string, use encodeURI.
This helper is available in the Winter ’27 release of Marketing Cloud Next.
| Parameter | Type | Description |
|---|---|---|
stringToEncode | String | Required. The string to encode. |
The function returns the URL-encoded string.
This example encodes a string of text so that it’s safe to include in a URL, converting all spaces and special characters.
The function returns this URL-encoded string: