[C,GTK2,GLib2] UTF-8 string comparision
From: Danijel Schiavuzzi (dschiavuBRISI_at_globalnet.hr)
Date: 08/26/03
- Next message: L: "Re: SOS - why does an application work fine with a hub but not a switch box?"
- Previous message: Noah Roberts: "Qt and automake"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Aug 2003 23:43:22 +0200
Hi.
I'm writing my first app with Glade2/GTK2/GLib in C.
I have a GtkListStore with 2 columns (like a dictionary, word and then
translation) which I fill in with strings read with fscanf from a
intentionally UTF-8 recoded file (it used to be win cp 1250, but UTF-8
is nicer, and Pango doesn't work with other charsets). Displaying it
in a GtkTreeView works nicely also.
1) I have these declared:
gchar* word1;
gchar* word2;
gchar* translation;
2) I fill word with the contents of a GtkEntry:
word1 = gtk_entry_get_text(entry); /* word to be searched */
3) The other word which is to be compared with the first I get with
gtk_tree_model_get(GTK_TREE_MODEL(list_store), &iter,
WORD_COLUMN, &word2,
TRANSLATION_COLUMN, &translation,
-1);
This runs in a loop comparing every row from the ListStore with the
word the user has written into the entry widget (word1):
4) Now I need to compare these two strings, UTF-8 encoded, word1 and
word2. I tried with strcmp() but it doesn't work. I searched for
a alternative function in the GLib 2 library but have found nothing
useful.
Any suggestions would be greatly appreciated!
Sorry for my possible bad English and bad explanations ;-)
-- #define QUESTION ((bb) || !(bb))
- Next message: L: "Re: SOS - why does an application work fine with a hub but not a switch box?"
- Previous message: Noah Roberts: "Qt and automake"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|