urlencode(
URL
)

The urlencode( function converts text into a legal URL (by converting spaces into %20). WARNING: THIS FUNCTION IS OBSOLETE.


Parameters

This function has one parameter:

url – text you want to make into a legal URL.


Description

This function converts text into a legal URL (by converting spaces into %20).

urlencode("now is the time") ☞ now%20is%20the%20time

Depending on your application, you may want to encode additional characters beyond the space. Using the percentescape( function, you can easily escape whatever characters you want. The RFC 2396 standard discusses different options for escaping characters when creating a URL.

WARNING: THE URLENCODE( function is obsolete. It is not possible to create a single function for all components of a URL, as different components of the URL require different characters to be encoded. For example, the query component of a URL allows the “@” character, but that character must be percent encoded when used in the password component. There are six different possible URL components: user, password, host, path, query and fragment.

http://user:password@host/path?query#fragment

To replace the obsolete urlencode( function, Panorama now includes six different functions for encoding each URL component separately:

You should use these functions instead of using the urlencode( function.

The most commonly used of these functions is encodeurlquery(. For example, suppose you have a database that has Address, City and State fields, and you want to pass that data to a website that displays maps based on parameters in the URL. The urlencodequery( function will ensure that the Unicode data in the database is correctly encoded to be passed in the generated URL.

"http://mymaps.com/displaymap?"+
    "Street="+encodeurlquery(Address)+
    "&City="+encodeurlquery(City)+
    "&Zip="+encodeurlquery(Zip)

For example, suppose the database contains this address:

 2024 Acadia Lane, Sàn Carlos, CA 98453

The generated URL will be:

http://mymaps.com/displaymap?Street=2024%20Acadia%20Lane&Address-S%C3%A0n%20Carlos&State=CA&Zip=98453

If needed, you can convert this encoded text back into the original, unencoded text using the percentunescape( function.


See Also


History

VersionStatusNotes
10.2UpdatedThis function is now deprecated and should not be used.
10.0No ChangeCarried over from Panorama 6.0