Base64UrlDecode()
Decodes a Base64URL-encoded string.
Requires Extension: Crypto Extension
Base64UrlDecode( encoded=string, charset=string );
Returns: any
| Argument | Description |
|---|---|
|
encoded
string,
required
|
edit
Base64URL-encoded string |
|
charset
string,
optional
|
edit
If provided, returns decoded data as string using this charset |
Examples
edit// Decode a Base64URL-encoded string back to its original form
// Returns binary by default
decoded = Base64UrlDecode( "SGVsbG8gV29ybGQ" );
// decoded is a binary value
str = charsetEncode( decoded, "UTF-8" ); // "Hello World"
// Pass a charset to get a string directly
decoded = Base64UrlDecode( "SGVsbG8gV29ybGQ", "UTF-8" );
// "Hello World"
// Handles missing padding automatically (Base64URL typically omits padding)
decoded = Base64UrlDecode( "dGVzdA", "UTF-8" ); // "test"
See also
- Base64UrlEncode()
- ToBase64()
- ToBinary()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)