Global Functions
The standard ECMAScript global functions in SSJS — URI encoding/decoding works but with x-www-form-urlencoded quirks (space becomes +, lowercase hex), while the legacy escape/unescape are missing entirely.
The standard ECMAScript global URI functions — encodeURI, encodeURIComponent, decodeURI, decodeURIComponent — all exist and are callable without loading Core. However, the SFMC Jint engine encodes like application/x-www-form-urlencoded, not RFC 3986: a space becomes + (not %20) and hex escapes are lowercase (%2f, not %2F). The legacy Annex-B escape / unescape functions are not defined at all. The numeric globals (parseInt, parseFloat, isNaN, isFinite, eval) are documented under Number Methods.
Status legend
| Icon | Meaning |
|---|---|
| ✅ Works | Available and behaves as expected |
| ⚠️ Partial | Available but with a documented caveat or bug |
| ❌ Missing | Not available (or undefined) — use the workaround |
Members
| Member | ES | Status | Notes |
|---|---|---|---|
encodeURI(uri) |
ES3 | ⚠️ Partial | Space → + (not %20), lowercase hex — |
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
|
| encodeURIComponent(str) | ES3 | ⚠️ Partial | Space → +, lowercase hex (%2f) —
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
|
| decodeURI(uri) | ES3 | ✅ Works | |
| decodeURIComponent(str) | ES3 | ⚠️ Partial | Decodes + as a space (form-urlencoded), unlike the spec —
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
|
| escape(str) | ES3 (Annex B) | ❌ Missing | undefined; use encodeURIComponent |
| unescape(str) | ES3 (Annex B) | ❌ Missing | undefined; use decodeURIComponent |
encodeURI
(ES3) — ⚠️ Partial.
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
Encodes a full URI, leaving reserved characters (/, ?, :, @, &, =, +, $, #) intact. In the SFMC Jint engine a space is encoded as +, not the spec-mandated %20, and percent-escapes use lowercase hex digits.
encodeURI("a b/c?d=1"); // "a+b/c?d=1" in SFMC (spec would give "a%20b/c?d=1")
MDN specifies encodeURI encodes a space as %20 and uses uppercase hex; the SFMC Jint engine encodes a space as + and emits lowercase hex escapes.
encodeURIComponent
(ES3) — ⚠️ Partial.
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
Encodes a URI component, escaping reserved characters too. Same engine quirks as encodeURI: space → + and lowercase hex.
encodeURIComponent("a b/c?d=1"); // "a+b%2fc%3fd%3d1" in SFMC (spec: "a%20b%2Fc%3Fd%3D1")
encodeURIComponent("/"); // "%2f" in SFMC (spec: "%2F")
MDN specifies encodeURIComponent encodes a space as %20 with uppercase hex; the SFMC Jint engine encodes a space as + and emits lowercase hex (e.g. / → %2f, not %2F).
decodeURI
(ES3) — ✅ Works. Reverses encodeURI, decoding percent-escapes back to their characters while leaving reserved characters intact.
decodeURI("a%20b/c"); // "a b/c"
decodeURIComponent
(ES3) — ⚠️ Partial.
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
Reverses encodeURIComponent, decoding all percent-escapes. In the SFMC Jint engine a literal + is decoded to a space (form-urlencoded behaviour), which the spec does not do.
decodeURIComponent("a%20b%2Fc"); // "a b/c"
decodeURIComponent("+"); // " " in SFMC (spec: "+" stays "+")
MDN specifies decodeURIComponent leaves a literal + unchanged; the SFMC Jint engine decodes + to a space, matching application/x-www-form-urlencoded rather than RFC 3986.
escape
(ES3, Annex B) — ❌ Missing. escape is not defined in the SFMC engine (typeof escape === "undefined"; calling it throws Object expected). Use encodeURIComponent instead.
// escape("a b"); // throws "Object expected: escape" in SFMC
encodeURIComponent("a b"); // use this instead
unescape
(ES3, Annex B) — ❌ Missing. unescape is not defined in the SFMC engine (typeof unescape === "undefined"; calling it throws Object expected). Use decodeURIComponent instead.
// unescape("a%20b"); // throws "Object expected: unescape" in SFMC
decodeURIComponent("a%20b"); // use this instead