12.1 Introduction

SICStus Prolog supports character codes up to 31 bits wide. It has a set of hooks for specifying how the character codes should be read in and written out to streams, how they should be classified (as letters, symbol-chars, etc.), and how strings of wide characters should be exchanged with the operating system. There are three sets of predefined hook functions supporting ISO 8859/1, UNICODE/UTF-8 and EUC external encodings, selectable using an environment variable. Alternatively, users may plug in their own definition of hook functions and implement arbitrary encodings.

WCX Concepts, introduces the basic WCX concepts and presents their implementation in SICStus Prolog. Prolog Level WCX Features, gives an overview of those Prolog language features that are affected by wide character handling. WCX Environment Variables, and WCX Hooks, describe the options for customization of SICStus Prolog WCX through environment variables and through the hook functions, respectively. WCX Foreign Interface, and WCX Features in Libraries, summarize the WCX extensions in the foreign language interface and in the libraries. WCX Utility Functions, describes the utility functions provided by SICStus Prolog to help in writing the WCX hook functions, while Representation of EUC Wide Characters, presents the custom-made internal code-set for the EUC encoding. Finally A Sample WCX Box, describes an example implementation of the WCX hook functions, which supports a composite character code set and four external encodings. The code for this example is included in the distribution as library(wcx_example).