CGIDecode

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All

Syntax

CGIDecode (stream[,mapplustospace {Default kTrue}]) Returns decoded-stream

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded,allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

You use CGIDecode to turn CGI-encoded text back into its original form. It is the inverse of CGIEncode.

When a client uses HTTP to invoke a script on a WEB server, it uses the CGI encoded format to pass the arguments to the server. This avoids any ambiguity between the characters in the argument names and values, and the characters used to delimit URLs, and the argument names and values.

stream is an Omnis Character or Binary field containing the information to decode.

MapPlusToSpace is a Boolean value. When kTrue, in addition to performing a standard CGI decode operation, the command maps all instances of the ‘+’ character in the input stream, to the space character.

DecodedStream is an Omnis Character or Binary field that receives the resulting CGI-decoded representation of the stream argument.

Note: The HTTPHeader, HTTPParse and HTTPPost commands automatically perform CGI encoding or decoding, as appropriate.

Example

Calculate lStream as  'Name: Charlie Malone,Company: Omnis Software'
CGIEncode (lStreamReturns lEncodedStream
CGIDecode (lEncodedStreamReturns lDecodedStream
# lDecodedStream now contains the following:
# Name: Charlie Malone,Company: Omnis Software
Calculate lStream as 'Name: Charlie Malone+Friend,Company: Omnis Software'
CGIEncode (lStreamReturns lEncodedStream
CGIDecode (lEncodedStream,kFalseReturns lDecodedStream
# lDecodedStream now contains the following:
# Name: Charlie Malone+Friend,Company: Omnis Software
CGIDecode (lEncodedStreamReturns lDecodedStream
# lDecodedStream now contains the following:
# Name: Charlie Malone Friend,Company: Omnis Software
# Note the + has been turned into a space character