Declares the source file text encoding. Requires a backend Prolog compiler supporting the chosen encoding. When used, this directive must be the first term in the source file in the first line.

The encoding used in a source file (and, in the case of a Unicode encoding, any BOM present) will be used for the intermediate Prolog file generated by the compiler. Logtalk uses the encoding names specified by IANA. In those cases where a preferred MIME name alias is specified, the alias is used instead. Examples includes 'US-ASCII', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-15', 'UCS-2', 'UCS-2LE', 'UCS-2BE', 'UTF-8', 'UTF-16', 'UTF-16LE', 'UTF-16BE', 'UTF-32', 'UTF-32LE', 'UTF-32BE', 'Shift_JIS', and 'EUC-JP'. When writing portable code that cannot be expressed using ASCII, 'UTF-8' is the most commonly supported encoding.

The backend Prolog compiler adapter files define a table that translates between the Logtalk and Prolog specific atoms that represent each supported encoding.

Template and modes



:- encoding('UTF-8').