Initializing help system before first use

urlencode

urlencode


Purpose
Encode a text string for a URL.
Synopsis
function urlencode(data:string|text):text
Argument
data 
Text to encode
Return value
Encoded text suitable for building a URL
Example
The following request sends query "qry" to the server "srv" requiring parameters "a" and "b". The values associated with these parameters are URL-encoded:
status:=httpget("http://srv/qry?a="+urlencode(a)+
    "&b="+urlencode(b), "result.txt")
Further information
1. This function converts a text string into a format that is compatible with URL conventions. The conversion consists in replacing characters with a special meaning by a portable representation based on the character code. For example, the character "&" is replaced by "%26".
2. Typically, query parameters have to be encoded when sending them via an HTTP GET request, data sent via POST may also have to be encoded.
Module