The optional keyword ENCODING is used to specify what encoding must be applied to a byte content to convert it to a Unicode string.

An ENCODING keyword value of *DEFAULT can be used to select the default encoding for the JVM.

XML services support the encoding value of *AUTODETECT. auto-detection of encoding is only possible on XML content and cannot be used for reading other content like comma-separated text files.

For HTTP services the ENCODING on the SERVICE_LOAD command enables the service to convert the standard input byte stream.

If no ENCODING value is available, the service uses the HTTP protocol content type charset value to determine the encoding used.

If no charset is present the encoding defaults to the JVM default file encoding or auto-detect for XML content.

The ENCODING value can be used on the SEND command of HTTP services to encode the HTTP request/response content, an appropriate charset value is automatically appended to the end of the content-type protocol line. The default encoding is UTF-8.

If the HTTP server is an IBM IBM i in MIXED output mode and the content type selected starts with 'text/', the encoding will have no effect, the text content will be encoded using the CGI-EBCDIC-CCSID value and the HTTP server will set the charset based on the DefaultNetCCSID entry in the server configuration.

Note that you need to run the International version of Java run-time. The US-only version does not contain all the encodings.

For further information refer to 5.1.2 IANA Encodings.