Within quoted atoms (using single quotes: '<atom>'
special characters are represented using escape-sequences. An escape
sequence is lead in by the backslash ()
character. The list of escape sequences is compatible with the ISO
standard, but contains one extension and the interpretation of
numerically specified characters is slightly more flexible to improve
compatibility.
\
\a
\b
\c
\<RETURN>\c but ISO compatible.
\f
\n
\r
\t
\v
\x2323 is just an
example. The `x' may be followed by a maximum of 2 hexadecimal digits.
The closing \ is optional. The code \xa\3
emits the character 10 (hexadecimal `a') followed by `3'. The code \x201
emits 32 (hexadecimal `20') followed by `1'. According to ISO, the
closing
\ is obligatory and the number of digits is unlimited. The
SWI-Prolog definition allows for ISO compatible specification, but is
compatible with other implementations.
\40
\<character>\ is
copied verbatim. Thus, '\\' is an atom consisting of a
single \ and
'\'' and '''' both describe the atom with a
single '.
Character escaping is only available if the
feature(character_escapes, true) is active (default). See
feature/2.
Character escapes conflict with writef/2
in two ways:
\40 is interpreted as decimal 40 by writef/2,
but character escapes handling by read has already interpreted as 32 (40
octal). Also,
\l is translated to a single `l'. Double the
(e.g. \\\, use the above escape sequences or use format/2.