[maemo-developers] [maemo-developers] Re: Nokia 770 sources...

From: Ross Burton ross at burtonini.com
Date: Tue Aug 29 22:40:53 EEST 2006
On Tue, 2006-08-29 at 20:10 +0200, Simon Budig wrote:
> Alessandro Ikeuchi (aikeuchi at santanderbanespa.com.br) wrote:
> > gtk_text_buffer_insert_at_cursor(mybuffer, "\u00E3", -1);
> gtk_text_buffer_insert_at_cursor () expects UTF-8 as the second
> argument. I don't know what C99 / C++ define for the "\u" excape
> sequences (probably wide chars or something like this), but I strongly
> suspect that the internal encoding is undefined and/or machine
> dependant.
> I am not at all convinced that this is supposed to work and I suggest
> that you assume the error on your side. Feel free to point me to the
> Ansi C99 standard that defines the internal encoding of wide char string
> constants to be UTF-8 though.

The spec as I read it is a little vague, and \u specifies a "universal
character" with no specific encoding.  I'm guessing it's the literal
codepoint.  As you say, GTK+ always expects UTF-8 (unless you are using
the gunichar API, in which \u should work).  Thanks to the
ever-wonderful gucharmap:

        General Character Properties
        Unicode category: Letter, Lowercase
        Canonical decomposition: U+0061 LATIN SMALL LETTER A + U+0303
        Various Useful Representations
        UTF-8: 0xC3 0xA3
        UTF-16: 0x00E3
        C octal escaped UTF-8: \303\243
        XML decimal entity: ã

If you want a literal ã in your C string for passing to a GTK+ function,
then use \303\243 to get the character in the UTF-8 encoding.

Ross Burton                                 mail: ross at burtonini.com
                                          jabber: ross at burtonini.com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF

More information about the maemo-developers mailing list