UrlEncode
Overview
Encode any spaces contained in a URL. By default, this function encodes spaces as %20. If you set the optional Boolean tag to true, the function returns all spaces as a + character.Syntax
UrlEncode(1, 2)
| Ordinal | Type | Description | |
|---|---|---|---|
| 1 | string | Required | URL to encode |
| 2 | Boolean | Indicates whether to encode spaces as a + character. A value of true encodes spaces, and a value of false does not encode spaces. |
Example
<script runat="server">
Platform.Function.UrlEncode("http://www.example.com?value=123 123");
</script>
<script>
Platform.Function.UrlEncode("http://www.example.com?value=123 123",true);
</script>
The system returns these values:
http://www.example.com?value=123%20123
http://www.example.com?value=123+123