Re: Upper case conversion and UTF8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le duodi 12 prairial, an CCXIV, Jens Madsen a écrit :
> Hi, i have this code to do an uppercase for my entry field.
> It is called by the "insert_text" signal.
> 
> It works fine for ascii values below 127 but not national chars f.ex.  "æøå".
> How do i convert the national chars ?

>    for( i = 0; i < len; i++)
>    {
>       result[i] = islower(text[i]) ? toupper(text[i]) : text[i];
>    }

As a rule, it is fundamentally impossible to operate on the _characters_ of
an UTF-8 encoded string by just looping over its bytes, so such a construct
could not work, even if islower and toupper had.

You should have a look at the Glib reference manual, especially the "Unicode
Manipulation" section <URL:
http://developer.gnome.org/doc/API/2.0/glib/glib-Unicode-Manipulation.html >.
You will probably find g_utf8_strup.

Attachment: signature.asc
Description: Digital signature

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux