Upper case conversion and UTF8

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 ?

void insert_text_callee(GtkEditable *editable, const gchar *text, gint len, int *position, gpointer
    int i;
    gchar *result = g_new(gchar, len);

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

   gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
                                     GTK_SIGNAL_FUNC (insert_text_callee),
   gtk_editable_insert_text (editable, result, len, position);
   gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
                                       GTK_SIGNAL_FUNC (insert_text_callee),

   gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");

   g_free (result);


Best regards
Jens Madsen

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