url_encode
string = url_encode (str[, charset])
This function returns the string str converted to into the MIME format called “x-www-form-urlencoded”. Most non-alphanumeric characters are converted into the 3-character string “%XX”, where XX is the two-digit hexadecimal representation of the 8–bit character. The following punctuation characters are not encoded: “-_.*”.
If any Unicode character in str is greater than 255, then a null string is returned unless you also supply the optional charset (character set) parameter. If a charset parameter is supplied, such characters are encoded in a multi-byte sequence using the given character set and then the resulting sequence will be URL encoded.
The following charset values are supported:
• iso8859-1
• iso8859-2
• iso8859-3
• iso8859-4
• iso8859-5
• iso8859-7
• iso8859-8
• iso8859-9
• ps_ascii
• ps_symbol
• jeuc
• sjis
• big5hku
• gb2312
• koi8
• ksc5601
• utf-8
• Unicode
For example, Unicode character 937 is a Greek Omega symbol (Ω). The following ACL call:
url_encode("A" . chr(937) . "B", "utf-8")
returns the following string:
A%CE%A9B
The UTF-8 encoding of Unicode character 937 is a multi-byte sequence consisting of: 0xCE and 0xA9.
Related Topics