Next: , Previous: Internal Representation of Characters, Up: Characters

5.5 ISO-8859-1 Characters

MIT/GNU Scheme internally uses ISO-8859-1 codes for I/O, and stores character objects in a fashion that makes it convenient to convert between ISO-8859-1 codes and characters. Also, character strings are implemented as byte vectors whose elements are ISO-8859-1 codes; these codes are converted to character objects when accessed. For these reasons it is sometimes desirable to be able to convert between ISO-8859-1 codes and characters.

Not all characters can be represented as ISO-8859-1 codes. A character that has an equivalent ISO-8859-1 representation is called an ISO-8859-1 character.

For historical reasons, the procedures that manipulate ISO-8859-1 characters use the word “ASCII” rather than “ISO-8859-1”.

— procedure: char-ascii? char

Returns the ISO-8859-1 code for char if char has an ISO-8859-1 representation; otherwise returns #f.

In the current implementation, the characters that satisfy this predicate are those in which the bucky bits are turned off, and for which the character code is less than 256.

— procedure: char->ascii char

Returns the ISO-8859-1 code for char. An error condition-type:bad-range-argument is signalled if char doesn't have an ISO-8859-1 representation.

— procedure: ascii->char code

Code must be the exact integer representation of an ISO-8859-1 code. This procedure returns the character corresponding to code.