EncodeBase64 Function

Converts a String to Base64 format.

Syntax
result = EncodeBase64( str, [lineWrap] )

Parameters
str | String | The String expression to be converted to Base64 format.
lineWrap | Integer (Optional) | Optional parameter. Specifies the maximum number of characters per line. The default value is 76, which is the line length specified by the Base-64 Content Transfer Encoding used in MIME. If you specify a value of 0, EncodeBase64 will not insert any linebreaks.

Return Value
Result | String | The Base64 representation of str.

# Notes

Base64 is used for email file attachments. SMTP was designed around the ASCII encoding, so it assumes that characters below ASCII 32 are control codes and it doesn't expect codes above ASCII 127. Base64 lets you encode arbitrary binary data into a 64-character alphabet composed of the printable ASCII characters. Three bytes of input become four characters of output. Base64 is also used in authentication schemes as a way to send an encryption key or hash value through a link that expects text.

The DecodeBase64 function performs the reverse operation, taking a Base64 expression and converting it to the original data.

# Example

The following example encodes UTF-8 text for transmission without line breaks.

Dim encodedText as String
encodedText = EncodingBase64(utf8text, 0)

# See Also

DecodeBase64 function.