Kaya 0.5.2 reference for WebCommon::urlEncode

List of functions and data types in WebCommon

String urlEncode(String x)

Arguments

Usage

URL encode a string. You should use this to encode reserved characters in URLs that you wish to be passed literally.

 // trying to pass "http://www.example.com" as a parameter
url = "http://localhost/test.cgi?url=";
url += urlEncode("http://www.example.com");
// url = http://localhost/test.cgi?url=http%3A%2F%2Fwww.example.com

Note that in the example above, encoding the whole URL would be incorrect - that would create a relative URL beginning "http://".

Related

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya