News
Abstract
UTF-8 CGI programming example
Content
You are in: IBM i Technology Updates > Web Integration on i > IBM HTTP Server for i > Introduction > CGI programming example > UTF-8 CGI programming example
This sample code is provided by IBM for illustrative purposes only. It has not been fully tested. It is provided as-is without any warranties of any kind, including but not limited to the implied warranties of merchantability and fitness for a particular purpose.
This program is a simple RPG program that demonstrates the HTTP server APIs for reading standard input and writing standard output. This is done with several containers with different CGIJobCCSIDs using the HTTP Server APIs. The same simple RPG program will be used and HTTP server will change the CCSID for each request.
To install the example program, do the following:
|
The input for this program comes from CGI standard input. For an HTTP request method of POST, the input is read from the standard input. For method POST, this program will only read 1024 characters.
The program reads data from standard input based on the Content_Length environment variable. The QtmhGetEnv System API is used to get the Content_Length and set the InDataLn variable used by the QtmhRdStdIn API. The data to be returned to the client is written to standard output using the QtmhWrStOut API. The data is returned as text/html.
Was this topic helpful?
Document Information
Modified date:
30 January 2020
UID
ibm11171264