ph_urlescape PowerHome formula function
Description
Escapes a URL or string based upon the flags parameter.
Syntax
ph_urlescape ( input, flags )
Argument Description
input String. The URL or string to escape
flags Integer. Controls what characters are escaped. See usage below.
Return value
String. Returns the escaped URL or string.
Usage
Use this function to escape a URL or string for proper transmission.

The flags parameter is detailed below. Add individual values together to achieve the desired flags parameter.
1 Add 1 to flags parm to escape these characters: # < > @ ;. The characters will be escaped as %xx where xx is the hexadecimal value for the character.
2 Add 2 to flags parm to escape these characters: { } | \ ^ ~ [ ] ` $. The characters will be escaped as %xx where xx is the hexadecimal value for the character.
4 Add 4 to flags parm to escape the % character. The % character will be escaped with %25.
8 Add 8 to flags parm to escape the / character. The / character will be escaped with %2f.
16 Add 16 to flags parm to escape the ? character. The ? character will be escaped with %3f.
32 Add 32 to flags parm to escape the & character. The & character will be escaped with %26.
64 Add 64 to flags parm to escape the = character. The = character will be escaped with %3d.
128 Add 128 to flags parm to escape the : character. The : character will be escaped with %3a.
256 Add 256 to flags parm to escape the " and ' characters. The " character is escaped with %22. The ' character is escaped with %27.
512 Add 512 to flags parm to escape the + character. The + character will be escaped with %2b.
1024 Add 1024 to flags parm to escape the space character. The space character will be escaped with %20.
2048 Add 2048 to flags parm to escape carriage return, line feed, and tab characters. The carriage return character will be escaped with %0d. The line feed character is escaped with %0a. The tab character is escaped with %09.
4096 Add 4096 to flags parm to escape every character. The characters will be escaped as %xx where xx is the hexadecimal value for the character.
8192 Add 8192 to flags parm to cause the escape process to ONLY escape characters after the first ? character.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_urlescape("http://www.power-home.com/ph-cgi/macro?id=TEST MACRO&parm1=<data>",9217)
The above example will return "http://www.power-home.com/ph-cgi/macro?id=TEST%20MACRO&parm1= %3cdata%3e"