Compdigitec Labs

« | Home | »

The “Gtk-CRITICAL gtk_text_buffer_emit_insert assertion” warning in PHP-GTK2

By admin | August 30, 2008

If your internationalized PHP-GTK2 apps have ever failed to work, you probably received the following message in the terminal before:

Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed

This means that you have been using or passing non-UTF8 (good chance that it is CP1252 on Windows) strings to PHP-GTK2 classes and methods, such as GtkWindow, GtkLabel or GtkTextBuffer. To fix this, you should use iconv to convert those non-UTF8 strings. Below is a list of commonly used encodings:

To use this list, take the encoding and put it in parameter 1. See below for examples:


// Convert from Chinese, Simplified
$result = iconv(“GB2312”,“UTF-8”,$source);

// Convert from Greek
$result = iconv(“ISO-8859-7”,“UTF-8”,$source);

// Convert from Arabic
$result = iconv(“ISO-8859-6”,“UTF-8”,$source);

// Convert from French, German, and other Western languages
$result = iconv(“windows-1252”,“UTF-8”,$source);


If, as an exception, that you don’t have the iconv extension (included on most PHP-GTK2 setups), you can change the php-gtk.codepage directive. However, this is not flexible and can only be used for one language.

If you found this article helpful or useful, please help Compdigitec by spreading the word or by leaving a comment. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: PHP | 8 Comments »

8 Responses to “The “Gtk-CRITICAL gtk_text_buffer_emit_insert assertion” warning in PHP-GTK2”

  1. get more info Says:
    October 6th, 2021 at 09:47

    … [Trackback]

    […] Read More here to that Topic: […]

  2. buy magic mushroom Says:
    October 7th, 2021 at 22:48

    … [Trackback]

    […] Find More on that Topic: […]

  3. buy magic mushrooms online Says:
    October 9th, 2021 at 03:05

    … [Trackback]

    […] Information to that Topic: […]

  4. bandar mejaqq terpecaya Says:
    November 8th, 2021 at 05:22

    … [Trackback]

    […] Here you will find 11107 more Information on that Topic: […]

  5. amazing places to see Says:
    December 2nd, 2021 at 11:57

    … [Trackback]

    […] Here you can find 66293 additional Info to that Topic: […]

  6. บาคาร่า1688 Says:
    December 17th, 2021 at 19:29

    … [Trackback]

    […] Here you can find 11796 additional Information to that Topic: […]

  7. สล็อตเว็บตรง Says:
    December 27th, 2021 at 18:27

    … [Trackback]

    […] Information to that Topic: […]

  8. Writing a Good Data Analysis Report: 5 Steps Says:
    January 10th, 2022 at 08:14

    … [Trackback]

    […] Read More to that Topic: […]