URLEncode
The URLEncode function converts a string to a URL encoded format.
This function parallels the Java function java.net.URLEncoder.encode().
Syntax
The URLEncode function
has the following syntax:
String = URLEncode(Expression, [Encoding])Parameters
The URLEncode function
has the following parameters.
Parameter |
Format |
Description |
|---|---|---|
|
String |
String that you want to encode. |
|
String |
The encoding scheme you want to use. This is
optional. The recommended and default encoding is |
Return value
The URL encoded string.
Example
The following example shows how to encode the query string of a URL and form a valid URL.
BaseURL = "http://hostname:port/query";
QName1 = "filter";
QVal1 = URLEncode("key='42ITA'");
QName2 = "comment";
QVal2 = URLEncode("#$&@^%$!!","UTF-8");
Querystring = "?" + QName1 + "=" + QVal1 + "&" + QName2 + "=" + QVal2;
FullURL = BaseURL + Querystring;
Log(FullURL);This example prints the following message to the policy log:
Parser Log:
http://hostname:port/query?filter=key%3D%2742ITA%27&comment
=%23%24%26%40%5E%25%24%21%21