Converts unsigned binary input into ASCII-encoded, printable characters.
WebAPI.bdh
WebBase64Encode( out sTarget :string, in nMaxTarget : number, out nLenTarget : number, in sSource : string, in nSourceLen : number optional ): boolean;
true if the encoding was successful
false otherwise
Parameter | Description |
---|---|
sTarget | String variable to receive the encoded string. |
nMaxTarget | Maximum number of characters to write into sTarget. |
nLenTarget | Parameter receiving the number of characters in sTarget after successful encoding. |
sSource | Source data to encode. This can also be binary data. |
nSourceLen | Length in bytes of the source data (optional). Specifiy STRING_COMPLETE or omit this parameter to encode all available data. |
For example, the string "testuser:testpass" is converted to "dGVzdHVzZXI6dGVzdHBhc3M=". Binary data can also be encoded in order to transport it safely over a 7-bit transport environment.
dcltrans transaction TWebOwnAuthHeader var sUserPass : string; nUserPassLen : number; begin // Build your own authentication header WebBase64Encode(sUserPass, 200, nUserPassLen, "smith:paranoia{}[]~^"); sUserPass := "Basic " + sUserPass; WebHeaderAdd("Authorization", sUserPass); WebUrl("http://standardhost/", 0.0); end TWebOwnAuthHeader;
WebEncoding01.bdf, WebForms02.bdf