CGI_CONTENT_TYPE

By default, the output generated by your CGI program is mapped as HTML content. To associate your CGI output with a MIME content type other than text/html, use the CGI_CONTENT_TYPE configuration variable. This variable lets you control the content type information in the header of output files created by ACUCOBOL-GT. Such information informs recipients of the type of content that they are about to receive.

Using this variable, you can configure your CGI program for many types of output, including eXtensible Markup Language (XML) or Wireless Markup Language (WML) for Wireless Application Protocol (WAP) devices like mobile phones.

character Whichever format you choose, the US-ASCII character set is applied to the output by default. If you want the CGI output to be mapped to an alternate character set such as ISO-8859-I (Western European), then you can specify the encoding set to use with the variable as well.

Include this variable in your runtime configuration file as follows:

CGI_CONTENT_TYPE contenttype; charset=encoding_set

Where contenttype is the MIME content type of the generated output, and encoding_set is the preferred character encoding set to use.

For example, the WML content type for WAP mobile phones is text/vnd.wap.wml. To associate your CGI output with WML, include the following in your configuration file:

CGI_CONTENT_TYPE text/vnd.wap.wml

If you want your WML output to be mapped to the Western European character set, include the following:

CGI_CONTENT_TYPE text/vnd.wap.wml; charset=iso-8859-I

The content type for eXtensible Markup Language (XML) documents is "text/xml". If your program generates XML data, include the following:

CGI_CONTENT_TYPE text/xml
CAUTION:
To avoid overriding other Content-Type associations, we suggest that you create a different configuration file for each of the MIME Content-Type associations that you make in your Web server setup.

Note that if you use this variable, the external forms indicated in your program's DISPLAY syntax must contain the appropriate content. In other words, if you associate your program with the text/xml content type, the forms must be .xml documents with XML syntax. If you associate it with text/vnd.wap.wml, the forms must be .wml documents with WML syntax. Your program can DISPLAY virtually any type of data, as long as the Content-Type ID corresponds to the external form file that you provide.

Be aware that if you do not use the proper file extension for your external form documents, the Web server will interpret the data as HTML and display the wrong data. WML and XML are also more sensitive to syntax errors than HTML.

In addition, note that the capabilities of the configuration entry CGI_NO_CACHE may be affected by the content type that you choose.

For information about writing a CGI program in COBOL, see Launching Web Applications Through CGI in A Programmer's Guide to the Internet.