Base64Encode
Encodes a string to Base64 format using UTF-8 encoding.
Syntax
Base64Encode(input)
Parameters
- input (string): The string to encode
Returns
- string: The Base64-encoded representation of the input string
Description
Converts the input string to bytes using UTF-8 encoding, then encodes those bytes as a Base64 string. The Base64 format string can then be safely transmitted over text-based protocols. See InvokeRestMethod()
Examples
var result1 = Base64Encode("Hello, World!") # Returns "SGVsbG8sIFdvcmxkIQ=="
var result2 = Base64Encode("Jyro") # Returns "Snlybw=="
var result3 = Base64Encode("") # Returns ""
# Encode a basic authentication header
var encoded = Base64Encode("username:password")
# Returns "dXNlcm5hbWU6cGFzc3dvcmQ="