Download CMUCL User`s Manual - Common

Transcript
CHAPTER 13. INTERNATIONALIZATION
182
For encoding-error, a character, symbol, or function can be specified, like decoding-error, with the same
meaning. The function, however, takes two arguments: a format message string and the incorrect codepoint. If
the function returns, it should be the replacement codepoint.
13.3.7.2
Utilities
stream:set-system-external-format terminal &optional filenames
[Function]
This function changes the external format used for *standard-input*, *standard-output*, and *standard-error*
to the external format specified by terminal. Additionally, the Unix file name encoding can be set to the value
specified by filenames if non-nil.
extensions:list-all-external-formats
[Function]
list all of the vailable external formats. A list is returned where each element is a list of the external format
name and a list of aliases for the format. No distinction is made between external formats and composing
external formats.
extensions:describe-external-format external-format
[Function]
Print a description of the given external-format. This may cause the external format to be loaded (silently) if
it is not already loaded.
Since strings are UTF-16 and hence may contain surrogate pairs, some utility functions are provided to make
access easier.
lisp:codepoint string i &optional end
[Function]
Return the codepoint value from string at position i. If code unit at that position is a surrogate value, it is
combined with either the previous or following code unit (when possible) to compute the codepoint. The first
return value is the codepoint itself. The second return value is nil if the position is not a surrogate pair. Otherwise, +1 or −1 is returned if the position is the high (leading) or low (trailing) surrogate value, respectively.
This is useful for iterating through a string in codepoint sequence.
lisp:surrogates-to-codepoint hi lo
Convert the given hi and lo surrogate characters to the corresponding codepoint value
[Function]
lisp:surrogates codepoint
[Function]
Convert the given codepoint value to the corresponding high and low surrogate characters. If the codepoint
is less than 65536, the second value is nil since the codepoint does not need to be represented as a surrogate
pair.
stream:string-encode string external-format &optional (start 0) end
[Function]
string-encode encodes string using the format external-format, producing an array of octets. Each octet is
converted to a character via code-char and the resulting string is returned.
The optional argument start, defaulting to 0, specifies the starting index and end, defaulting to the length
of the string, is the end of the string.
stream:string-decode string external-format &optional (start 0) end
[Function]
string-decode decodes string using the format external-format and produces a new string. Each character
of string is converted to octet (by char-code) and the resulting array of octets is used by the external format to
produce a string. This is the inverse of string-encode.
The optional argument start, defaulting to 0, specifies the starting index and end, defaulting to the length
of the string, is the end of the string.
string must consist of characters whose char-code is less than 256.