Next: , Previous: , Up: Argument Conversion   [Contents][Index]


2.4.5 Strings

Native strings are expected to be either in the locale encoding or in UTF-8. Guile strings are arrays of Unicode codepoints.

GObject libraries usually use UTF-8 encoding for their strings, while Guile uses a different encoding internally for its strings. Thus every time a string is parameter is passed through to a C procedure, a new UTF-8 copy of the Guile string is created. The string is automatically freed when no longer in use.

GObject has some procedures that deal with locale-encoded strings: notably those procedures that deal with environment variables. Guile-GI converts Guile strings to locale-encoded strings for those procedures. Note that this may throw an encoding error if the Guile string cannot be represented in the current locale.