:utf-16 &key use-replacement little-endian
:utf-16be &key use-replacement
:utf-16le &key use-replacement
The external format :utf-16
and variants implement translations according to the UTF-16 standard of Unicode.
The variants differ only in their treatment of byte order.
The parameter use-replacement is a boolean which defaults to nil
. It controls what happens when reading encounters an illegal combination. Illegal combinations are either a leading surrogate (#xd800
to #xdbff
) not followed by a trailing surrogate (#xdc00
to #xdfff
), or a trailing surrogate not following a leading surrogate. By default, the input code signals an error of type external-format-error. If use-replacement is non-nil, the input code replaces the error byte or pair of bytes by the replacement character (#xfffd
).
:utf-16-native
and :utf-16-reversed
implement UTF-16 in the native or the reverse of the byte order of the computer that they are executing on.
:utf-16be
and :utf-16le
implement the UTF-16BE and UTF-16LE standard format, that is UTF-16 big-endian and UTF-16 little-endian. The system maps these to either of :utf-16-native
or :utf-16-reversed
.
:utf-16
implements the UTF-16 standard. The byte order defaults to big-endian byte order.
When opening a file with :external-format :utf-16
(without passing little-endian), the system checks for the existence of the BOM (Byte Order Mark) in the beginning of the file, and if there is a BOM uses it to determine the right byte order. Otherwise, it uses big-endian (:utf-16be
). There are no checks for a BOM in other situations.
These formats are new in LispWorks 7.0.
In LispWorks 6.1 and earlier versions the :unicode external format is the format to read 16-bit characters.
LispWorks User Guide and Reference Manual - 13 Feb 2015