Base64Decode

This function decodes a Base64 encoded string.

Arguments

Base64Decode(1,2,3)

Ordinal Type Required Description
1 String True String value to decode
2 String False Optional .NET-supported character-encoding type to utilize in decoding (ASCII, UTF-7, UTF-8, UTF-16, and UTF-32)
3 Number False When utilized in an email message, a value of 1 will abort the send if the specified string cannot be successfully decoded. A value of 0 will allow the send to continue. The default value is 1.

Example

%%[

var @str
var @enc
var @encASCII
var @encUTF7
var @encUTF8
var @encUTF16
var @encUTF32
var @dec
var @decASCII
var @decUTF7
var @decUTF8
var @decUTF16
var @decUTF32

set @enc  = "ZG91Z0BsaW1lZGFzaC5jb20="
set @encASCII = "ZG91Z0BsaW1lZGFzaC5jb20="
set @encUTF7 = "ZG91ZytBRUEtbGltZWRhc2guY29t"
set @encUTF8 = "ZG91Z0BsaW1lZGFzaC5jb20="
set @encUTF16 = "ZABvAHUAZwBAAGwAaQBtAGUAZABhAHMAaAAuAGMAbwBtAA=="
set @encUTF32 = "ZAAAAG8AAAB1AAAAZwAAAEAAAABsAAAAaQAAAG0AAABlAAAAZAAAAGEAAABzAAAAaAAAAC4AAABjAAAAbwAAAG0AAAA="

set @dec = Base64Decode(@enc)
set @decASCII = Base64Decode(@encASCII, "ASCII")
set @decUTF7 = Base64Decode(@encUTF7, "UTF-7")
set @decUTF8 = Base64Decode(@encUTF8, "UTF-8")
set @decUTF16 = Base64Decode(@encUTF16, "UTF-16")
set @decUTF32 = Base64Decode(@encUTF32, "UTF-32")

]%%
enc: %%=v(@enc)=%%
<br>encASCII: %%=v(@encASCII)=%%
<br>encUTF7: %%=v(@encUTF7)=%%
<br>encUTF8: %%=v(@encUTF8)=%%
<br>encUTF16: %%=v(@encUTF16)=%%
<br>encUTF32: %%=v(@encUTF32)=%%
<br>dec: %%=v(@dec)=%%
<br>decASCII: %%=v(@decASCII)=%%
<br>decUTF7: %%=v(@decUTF7)=%%
<br>decUTF8: %%=v(@decUTF8)=%%
<br>decUTF16: %%=v(@decUTF16)=%%
<br>decUTF32: %%=v(@decUTF32)=%%

Output

enc: ZG91Z0BsaW1lZGFzaC5jb20=
encASCII: ZG91Z0BsaW1lZGFzaC5jb20=
encUTF7: ZG91ZytBRUEtbGltZWRhc2guY29t
encUTF8: ZG91Z0BsaW1lZGFzaC5jb20=
encUTF16: ZABvAHUAZwBAAGwAaQBtAGUAZABhAHMAaAAuAGMAbwBtAA==
encUTF32: ZAAAAG8AAAB1AAAAZwAAAEAAAABsAAAAaQAAAG0AAABlAAAAZAAAAGEAAABzAAAAaAAAAC4AAABjAAAAbwAAAG0AAAA=
dec: [email protected]
decASCII: [email protected]
decUTF7: [email protected]
decUTF8: [email protected]
decUTF16: [email protected]
decUTF32: [email protected]