Previous: Character Sets, Up: Characters


5.7 Unicode

MIT/GNU Scheme provides rudimentary support for Unicode characters. In an ideal world, Unicode would be the base character set for MIT/GNU Scheme. But MIT/GNU Scheme predates the invention of Unicode, and converting an application of this size is a considerable undertaking. So for the time being, the base character set for strings is ISO-8859-1, and Unicode support is grafted on.

This Unicode support was implemented as a part of the XML parser (see XML Support) implementation. XML uses Unicode as its base character set, and any XML implementation must support Unicode.

The basic unit in a Unicode implementation is the scalar value. The character equivalent of a scalar value is a Unicode character.

— procedure: unicode-scalar-value? object

Returns #t if object is a Unicode scalar value. Scalar values are implemented as exact non-negative integers. They are further limited, by the Unicode standard, to be strictly less than #x110000, with the values #xD800 through #xDFFF, #xFFFE, and #xFFFF excluded.

— procedure: unicode-char? object

Returns #t if object is a Unicode character, specifically if object is a character with no bucky bits and whose code satisfies unicode-scalar-value?.

The Unicode implementation consists of these parts: