Re: Invalid UTF-8... the comeback :-)



This program works for me:

#include <gtk/gtk.h>

gint
main (gint argc, gchar **argv)
{
  GtkWidget *window;
  GtkWidget *label;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (window), 48);
  g_signal_connect (G_OBJECT (window), "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);

  gtk_widget_show (window);

  label = gtk_label_new ("ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ");
  gtk_widget_show (label);

  gtk_container_add (GTK_CONTAINER (window), label);

  gtk_main ();

  return 0;
}

Of course, it has to be encoded in UTF-8. If your strings
are in some other encoding, you can convert them using
g_iconv or related functions. Havoc's thing is a bit of a
hack that only works for iso8859-1, if I understand it
correctly.

Noah


On Thu, Feb 27, 2003 at 19:15:57 +0100, Emmanuel Saracco wrote:
hi all,

how can I display caracters like "Â" with gtk2?
I always have the now famous "[Invalid UTF-8]" message...

encoding my string with "g_string_append_unichar" like advised by havoc
pennington in
http://mail.gnome.org/archives/gtk-app-devel-list/2002-November/msg00325.html
do nothing :-(

thanks,

bye
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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