Next: Numbers, Previous: Booleans, Up: Argument Conversion [Contents][Index]
There are two native character types, the 1-byte gchar
and the
4-byte gunichar
. The native 1-byte gchar
character type
can represent many types of data, so understanding what a function wants
depends on context. It could be a single-byte character in a specific
character encoding, a binary byte with no specific encoding, or an 8-bit
integer. The native gunichar
type always represents a Unicode
codepoint.
When a 1-byte gchar
is expected, if you pass a Guile character,
the presumption is that Latin-1 encoding is correct, e.g. if a Guile
character has codepoints U+0000 to U+00FF, it will be converted to a
1-byte integer and passed to the gchar
. A Guile integer can also
be passed when a native gchar
is expected.
When gchar
is an output or return value, it is returned as an
integer because it is not possible to know what it is meant to
represent.