Error getting tags :
error 404Error getting tags :
error 404 URLEncode | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
URLEncode
Basics
Expander triangle
Type
Function
Syntax
the URLEncode of formString URLEncode(formString)
See Also
Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
Network
Summary
Returns a string that has been transformed so that it can be posted to an HTTPserver as a URL.
Examples

URLEncode("ABC123") -- returns "ABC123"
URLEncode("Test string $$") -- returns "Test+string+%24%24"
put URLEncode("http://www.example.net/document.html") into newURL

Additional Comments
Expander triangle

Use the URLEncode function to encode a URL so it can be safely posted to an HTTP server.

Parameters:

The formString is any string, or any expression that evaluates to a string.

Value:

The URLEncode function returns the formString, with spaces converted to "+" and characters other than letters and numbers converted to their hexadecimal escape representation.

Comments:

Letters and numbers (alphanumeric characters) are not transformed by the URLEncode function. The representation used for non-alphanumeric characters is a percent sign followed by two hexadecimal digits. For example, the ASCII value of the character ~ is 126; the hexadecimal equivalent of 126 is 7E. So wherever the character ~ appears in the formString, it is converted to "%7E".

User Comments
Expander triangle
User thumbnail
Mark Smith
StarStarStarStarStar
Apr 15, 2009
There is another, very similar encoding, sometimes called "percent encoding" in which spaces are encoded to "%20" instead of "+". Here's a handler that does it:


function pcEncode pString
put urlencode(pString) into tEncoded
replace "+" with "%20" in tEncoded
replace "*" with "%2A" in tEncoded
return tEncoded
end pcEncode

User thumbnail
Mark Smith
StarStarStarStarStar
Apr 20, 2009
pcEncode() appears to be equivalent to the javaScript escape() function, which is handy for ajax-type stuff.