Encodes any unsafe characters included in URLs in order to comply with the Uniform Resource Locators specification. This encoding is commonly applied to URL parameters or FORM post parameters.
WebAPI.bdh
WebFormUrlEncode( out sTarget :string, inout nMaxTarget : number, in sSource : string ): boolean;
true if encoding was successful
false if an error occurred or the buffer size is too small
Parameter | Description |
---|---|
sTarget | String variable to receive the encoded string |
nMaxTarget | Parameter containing the maximum number of characters to write into sTarget. This value must be <=<= the size of sTarget. If the buffer size is too small, WebFormUrlEncode returns false and sets nMaxTarget to the needed size. |
sSource | Source string to encode |
Printable ASCII characters being URL-encoded to its hexadecimal representation %hh by Silk Performer: % ? # [ ] { } | \ & = @ : ^ ~ ` " $ + ! * ' ( ) , < > ; /
dcltrans transaction TWebFormUrlEncode var sUrl : string; sPass : string(100); nPassLen : number; begin // Encode all unsafe characters in a password nPassLen := sizeof(sPass); WebFormUrlEncode(sPass, nPassLen, "paranoia{}[]~^"); sUrl := "http://smith:" + sPass + "@standardhost/"; WebUrl(sUrl); end TWebFormUrlEncode;
WebEncoding01.bdf