使用 unit base64;
编码函数
function EncodeStringBase64(const s:string):String;
解码函数
function DecodeStringBase64(const s:string;strict:boolean=false):String;
解释:
(* The TBase64DecodingStream supports two modes:
* - 'strict mode':
* - follows RFC3548
* - rejects any characters outside of base64 alphabet,
* - only accepts up to two '=' characters at the end and
* - requires the input to have a Size being a multiple of 4; otherwise raises an EBase64DecodingException
* - 'MIME mode':
* - follows RFC2045
* - ignores any characters outside of base64 alphabet
* - takes any '=' as end of string
* - handles apparently truncated input streams gracefully
*)
TBase64DecodingMode = (bdmStrict, bdmMIME);