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

:utf-32

:utf-32le

:utf-32be

:utf-32-native

:utf-32-reversed External Formats

Summary

Implement UTF-32 format, which means reading and writing 32-bit chunks as characters.

Package

keyword

Signatures

:utf-32 &key use-replacement little-endian

:utf-32le &key use-replacement

:utf-32be &key use-replacement

:utf-32-native &key use-replacement

:utf-32-reversed &key use-replacement

Arguments
use-replacement
A generalized boolean.
little-endian
A generalized boolean.
Description

The external format :utf-32 and its variants implement UTF-32 format, which means reading and writing 32-bit chunks as characters.

:utf-32-native and :utf-32-reversed are the actual implementation formats. They implement UTF-32 with the native byte order (:utf-32-native) or the reversed byte order (:utf-32-reversed).

:utf-32le and :utf-32be implement UTF-32 with little-endian (:utf-32le) and big-endian (:utf-32be) byte order. LispWorks maps them to one of :utf-32-native or :utf-32-reversed as appropriate.

:utf-32 implements UTF-32 with control over the byte order. This format maps to one of :utf-32-native or :utf-32-reversed as appropriate. If little-endian is supplied, it determines the byte order. Otherwise, if it is used for opening a file, LispWorks checks whether the file starts with the BOM (Byte Order Mark), and uses it if found. Otherwise the big-endian order is used. LispWorks uses the required byte order and the native byte order of the computer it executes on to decide whether to use :utf-32-native or :utf-32-reversed.

If the :utf-32 formats encounter a surrogate code point or a character code which is too large, they by default signal an error of type external-format-error. If use-replacement is non-nil, they replace the illegal input by the replacement character. When use-replacement is non-nil these formats never signal an error.

When writing, the :utf-32 formats never signal an error.

Compatibility notes

These formats were new in LispWorks 7.0. In LispWorks 6.1 and earlier versions there is an undocumented external format character that works similarly to :utf-32-native in LispWorks 7.0 and later. This is now mapped to :utf-32-native to avoid errors in existing code, and should not be used in new code.

See also

26.6 External Formats to translate Lisp characters from/to external encodings


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