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. This directive is also supported in files included in a main file or in a dynamically created entity using include/1 directives.
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
In those cases where a preferred MIME name alias is specified, the alias is
used instead. Examples includes
'EUC-JP'. When writing portable code that cannot be expressed using
'UTF-8' is the most commonly supported Unicode encoding.
The backend Prolog compiler adapter files define a table that translates between the Logtalk and Prolog specific atoms that represent each supported encoding. The encoding_directive read-only flag can be used to find if a backend supports this directive and how.
Template and modes¶