EncodeBase32 (open)

Encodes a string into an RFC 4648 base-32 encoded string

Syntax

// Core function, no LOADLIB necessary

STRING FUNCTION EncodeBase32(STRING value, BOOLEAN dontpad)

Parameters

STRING value

String to encode

BOOLEAN dontpad

If set to TRUE, the resulting string is not padded

Return value

STRING

The encoded string

Description

This function encodes a string to base-32 encoding. This way non-printable ASCII characters can be safely encoded, and the result can easily be entered by a person. The resulting string contains no ambiguous characters (i.e. 1, 8 and 0 are not used as they can be confused with I, B and 0, respectively) and letters can be either uppercase or lowercase. The alphabet used is the one from RFC 4648 (table 3, chapter 6). The resulting string is padded using '=' characters until the length is a multiple of 8 characters.

Examples

// returns "JBSWY3DPFQQFO33SNRSA===="
STRING example1 := EncodeBase32("Hello, World");

// returns "GEZDG==="
STRING example2 := EncodeBase32("123");