Description

Returns a URL-encoded version of a string.

Copy
 string u( string input )

This is useful when passing a query string parameter as part of a link. If there is any possibility that a parameter value might contain special characters such as spaces, you should use the u( ) function on that parameter.

A string that is not a Zephyr variable needs quotes around it.

string u('string input')

Example

 http://www.mysite.com?username={u(username)}&name={u(name)}

URL-Encode a Value

Use Case: If you need to pass any information, such as a user name, in a URL as a query string parameter. To prevent the link breaking, always use u() which allows you to URL-encode special characters. For example, the user name value "Sailthru User" would become "Sailthru%20User"

Zephyr:

http://example.com?username={u(userName)}

Output:

http://example.com?username=Sailthru%20User

Explanation: This script uses the u() function to add URL-encoding to a query parameter. In this instance, the space between "Sailthru" and "User" is being converted to the ASCII "%20".