To display text properly when viewing or downloading spooled files as text, the PUIWRKSPLF utility needs to let the HTTP server know how the text is encoded. The utility can not always detect the file encoding automatically. By default, the PUIWRKSPLF uses the CPYSPLF command to convert spooled files to text. The CPYSPLF command can choose different encodings for the output file, depending on the spooled file attributes. CPYSPLF sets the output file CCSID to 65535, so the actual encoding used is unknown. Also, spooled files can be converted to text via custom logic run from the exit program.
By default, PUIWRKSPLF assumes text files are encoded in UTF-8. If your text files are created with a different encoding, the output will not display properly. To customize the output character set, you can set the environment variable PUI_WRKSPLF_CHARSET either in the HTTP server configuration, or via custom logic in the PUISPLEXIT exit program.
To set the variable in the HTTP server configuration, edit the HTTP server configuration file at /www/INSTANCE_NAME/conf/httpd.conf. The default instance name is PROFOUNDUI, but can be customized at installation time. The configuration directive should be added to the global area of the configuration file – outside of any <Directory>, <Files>, <VirtualHost>, or other blocks.
If custom logic is needed to set the encoding differently depending on the particular file, RPG code like this can be used in the exit program: