Hi,

I'm trying to set the text in a GtkLabel to a UTF-8 string, which
contains some arabic characters first, followed by my email address in
angle brackets, followed by my name in round brackets.  For e.g., a
sample value is:

X <[EMAIL PROTECTED]> (Gaurav Jain)

In the above, 'X' represents a valid sequence of arabic UTF-8
characters.  The problem that I see is that when I run this program
(appended to this mail), the output shown is something like this:

([EMAIL PROTECTED]> (Gaurav Jain> X

Note that the angle and round brackets are all messed up, and that
order of arabic and ascii words is also wrong.  Does anyone know WHY
this is happening?  Just for information, I'm using GTK 2.4.14.  Also,
I was surprised to discover that this works fine with an older version
of GTK (2.0.9).  Does something special need to be done so I can get
it to work with GTK >= 2.4?

Thanks,
Gaurav

-----------------
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>

int main( int   argc, char *argv[] )
{
        GtkWidget *window;
        GtkWidget *vbox, *hbox;
        GtkWidget *label;

        gtk_init (&argc, &argv);

        /* create a new window */
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_widget_set_size_request (GTK_WIDGET (window), 300, 100);

        vbox = gtk_vbox_new (FALSE, 0);
        gtk_container_add (GTK_CONTAINER (window), vbox);
        gtk_widget_show (vbox);

        char text[200] = "";

        text[0] = -40;
        text[1] = -87;
        text[2] = '\0';

        strcat(text, "<[EMAIL PROTECTED]> (Gaurav Jain)");
        label = gtk_label_new (text);

        gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
        gtk_widget_show (label);

        gtk_widget_show (window);

        gtk_main();

        return 0;
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to