Re: Unexpected UTF



Tony Freeman wrote:

Hi Gang!

I'm getting an unexpected "Invalid UTF-8" thingy-ma-gumby with this
function:

void on_execute_button_clicked (GtkButton *button, gpointer user_data)
{
        GtkWidget *entry1  = lookup_widget(GTK_WIDGET(button), "entry1" );
        GtkWidget *entry2  = lookup_widget(GTK_WIDGET(button), "entry2" );
        GtkWidget *window1 = lookup_widget(GTK_WIDGET(button), "window1");
        
        if (entry1 == NULL || entry2 == NULL) {
                quick_message(window1, "You must provide both a PAR and RAR file.");
        }

        g_print("entry1: %s\nentry2: %s\n", entry1, entry2);
}

The above function prints out:
[Invalid UTF-8] entry1: \x80.\x0b\x08\x02
entry2: \x80.\x0b\x08\x02
entry1 and entry2 are pointers to the entry widgets themselves, not the strings contained in them. you need to use gtk_editable_get_text() for that. i'd suggest you read through the gtk tutorial at gtk.org, and have a look at the API docs.

   -brian



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