12.4 Selecting the WCX Mode Using Environment Variables

When the SICStus Prolog system starts up, its WCX mode is selected according to the value of the SP_CTYPE environment variable. The supported values of the SP_CTYPE environment variable are the following:

iso_8859_1 (default)
character code set:
0..255
character-type mapping:
according to the ISO 8859/1 standard; see Token String.
external encoding:
each character code is mapped to a single byte on the stream with the same value (trivial encoding).

utf8
character code set:
0..2147483647 (= 2^31-1)
character-type mapping:
according to ISO 8859/1 for codes 0..255. All codes above 255 are considered small-letters.
external encoding:
UTF-8

This WCX mode is primarily intended to support the UNICODE character set, but it also allows the input and output of character codes above the UNICODE character code range.

euc
character code set:
a subset of 0..8388607 The exact character code set is described in Representation of EUC Wide Characters, together with its mapping to the standard external encoding.
character-type mapping:
according to ISO 8859/1 for codes 0..127. All codes above 127 are considered small-letters.
external encoding:
EUC encoding with the lengths of the sub-code-sets dependent on the locale.

In all three cases the system encoding is implemented as truncation to 8-bits, i.e. any code output to the operating system is taken modulo 256, any byte coming from the operating system is mapped to the code with the same value.

The figure below shows an example interaction with SICStus Prolog in EUC mode. For the role of the SP_CSETLEN environment variable, see Representation of EUC Wide Characters.


images/kterm.png
SICStus Prolog in EUC mode