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

:unicode External Format

Summary

Implements UTF-16 translation.

Package

keyword

Signature

:unicode &key little-endian

Arguments
little-endian
A generalized boolean.
Description

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 supplying little-endian), LispWorks 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.

Notes

: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

26.6 External Formats to translate Lisp characters from/to external encodings
26.6.2 16-bit External formats guide


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:34