Prolog-based base64 encoding using DCG rules. Encoding according to rfc2045. For example:
1 ?- base64('Hello World', X). X = 'SGVsbG8gV29ybGQ='. 2 ?- base64(H, 'SGVsbG8gV29ybGQ='). H = 'Hello World'.
The Base64URL encoding provides a URL and file name friendly alternative to base64. Base64URL encoded strings do not contain white space.
classic
uses the classical rfc2045 characters. The value url
uses URL
and file name friendly characters. See base64url/2. The value
openbsd
uses the OpenBSD password-file alphabet.true
(default), the output is padded with =
characters.string
(default) or
atom
.utf8
.as(atom)
and
encoding(iso_latin_1)
.
Equivalent to base64_encoded/3 using the options as(atom)
,
encoding(utf8)
and charset(url)
.