setCharacterEncoding()

The sysLib.setCharacterEncoding() system function specifies an alternative encoding for character text (CHAR, MBCHAR, or DBCHAR variables).

EGL assumes that CHAR, MBCHAR, or DBCHAR variables always use the default file encoding for Java programs. You can use the sysLib.setCharacterEncoding() function to specify the encoding of character text (CHAR, MBCHAR, or DBCHAR variables) when those variables are converted to UNICODE text in a UNICODE or STRING variable and vice versa. This allows different encodings to be used within a single program.

Syntax

  sysLib.setCharacterEncoding(
arg any in, 
encoding STRING in)
arg
The name of a variable in any of the following types:
  • A record
  • A CHAR, MBCHAR, or DBCHAR variable
  • A CHAR, MBCHAR, or DBCHAR array or multidimensional array
encoding
Any valid encoding that is accepted by the java.lang.String.getBytes() method in Java environments.

Example

The following example sets the encoding of a CHAR-type variable:

  sysLib.setCharacterEncoding(aChar, "GBK")

Compatibility

Table 1. Compatibility considerations for setCharacterEncoding()
Platform Issue
COBOL generation The setCharacterEncoding() function is not supported.
JavaScript generation The setCharacterEncoding() function is not supported.