All Manuals > LispWorks User Guide and Reference Manual > 37 The EXTERNAL-FORMAT Package



External Format

Implements UTF-16 translation.


:unicode &key little-endian


The external format :unicode implements UTF-16 translation, with default byte order the native one. :unicode is equivalent to (:utf-16 :little-endian little-endian) where the value of little-endian depends on the byte order of the native machine.

When opening a file with :external-format :unicode (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 correct byte order. Otherwise, it uses the native byte order. There are no checks for a BOM in other situations.


:unicode differs from :utf-16 when little-endian is not supplied and there is no BOM, because :unicode uses the native endianness and :utf-16 uses big-endian. In all other circumstances :unicode is equivalent to :utf-16.

Compatibility note

In LispWorks 6.1 and earlier versions, :unicode reads only 16-bit characters, including character objects corresponding to surrogate code points. There is no exact match to that in LispWorks 7.0 and later, because there is no external format that reads surrogates. :bmp can be used to read 16-bit characters, either giving an error or using the replacement character for surrogate code points.

See also

16-bit External formats guide

LispWorks User Guide and Reference Manual - 13 Feb 2015