UnEscape

UnEscape

The UnEscape procedure converts characters from a URL-encoded string containing escaped data to non-escaped data.

unescaped-string  UnEscape(
  szEscapedText      32766A   Value Varying 
)

See also: ToEBCDIC, ToHex

Parameters

szEscapedText
[input VChar(*) const]  A varying or fixed-length character value whose length is 1 to 32766. The value of this parameter is not modified but is translated to an unescaped string. The web browser's CCSID is used as the source of the escaped string's hex values and the servers CCSID is used as the target of the converted text.

Return Value

If the function succeeds, the return value is the converted text from the szEscapedText parameter. The converted text will being in the CCSID character set of the server. If the function fails, no value is returned, that is the return value is an empty string, or blanks.

Remarks

The procedure works by first converting all plus sign (+) symbols to blanks. Then it searches for each occurrence of a hexadecimal symbol in the %xx format. It translates that hex value to character and then using the browser and server CCSID's it converts the character value to the server CCSID. For example:

mycgi.pgm?CUSTNO=304&NAME=Bob%20Cozzi%2C%20Jr%2E

mycgi.pgm?CUSTNO=204&NAME=Bob Cozzi, Jr.