Encodes a character string or a buffer. To decode the result, simply use
Decode.
// Encode an image in Base64
Res is string = Encode(fLoadBuffer("MyImage.jpg"), encodeBASE64)
// Encode a URL
Info(Encode("https://www.google.fr/?", encodeURLFromAnsi) + ...
Encode(Encode("https://www.google.fr/?é", encodeURLFromAnsi), encodeURLParameter))
Syntax
<Result> = Encode(<Data> [, <Encoding format>])
<Result>: Character string
Data encoded according to the selected format.
<Data>: Character string or Buffer
Data to encode.
<Encoding format>: Optional Integer constant
Format for encoding data: | |
encodeBASE64 (Default value) | BASE 64 format (complies with the RFC 4648 standard). Encoded text contains only printable characters and CRs (Carriage Returns). |
encodeBASE64NoCR | BASE 64 format (complies with RFC 4648 standard) without RCs (Carriage Returns). The encoded text contains printable characters only. |
encodeBASE64URL | BASE 64 URL format (complies with the RFC 4648 standard). The encoded text contains printable characters only. |
encodeBASE85 | BASE 85 format. The encoded text contains printable characters only. |
encodePCS | ASCII format. The encoded text contains printable characters only. |
encodeURLFromAnsi | URL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string. |
encodeURLFromUnicode | URL format. The encoded text only contains characters allowed in a URL. The text to encode is a Unicode string. |
encodeURLFromUTF8 | URL format. The encoded text only contains characters allowed in a URL. The text to encode is a UTF-8 string. |
encodeURLParameter | This constant is used when it is necessary to pass a given URL (URL A) as a parameter to another URL (URL B). The reserved characters of URL A (//,?...) are encoded. URL A (to be encoded) must be a valid URL. If it has its own parameters, they must have been encoded with one of the following constants: encodeURLFromAnsi, encodeURLFromUnicode or encodeURLFromUTF8. |
encodeUUEncode | UUEncode format. The encoded text contains printable characters only. |
Business / UI classification: Business Logic