Re: OT: Problem with swedish characters and gtk_label



On 4/29/05, Magnus Wirström <asdlinux yahoo se> wrote:
> I'm working with a application that uses swedish characters and i have a problem with displaying swedish characters with gtk_label. I can use ÅÄÖ when the label is created and it display it correctly but then i use gtk_label_set_text() to update the text, it stops the word when the swedish characer occurs. Looks something like this ...
> 
> Original word i want to display:
> Norrköping
> 
> Result i get with gtk_label_set_text():
> Norrk

Make sure the string you're trying to use as a label text is valid
UTF-8. If you got it from a file or any other external source, use
g_locale_to_utf8[1] or some other conversion function to convert it
from the source encoding (Which probably is ISO-8859-1 in your case).

Basically, *all* strings that are passed to GUI elements needs to be
valid UTF-8, or else you'll see errors like the one you got.

[1] http://developer.gnome.org/doc/API/2.0/glib/glib-Character-Set-Conversion.html#g-locale-to-utf8
-- 
Isak Savo
isak · savo (at) gmail · com



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