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:

<?php

// 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 | 16 Comments »

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

  1. maid service raleigh nc Says:
    February 8th, 2022 at 11:30

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  2. swiss audemars piguet royal oak 26574 11 Says:
    March 13th, 2022 at 13:51

    … [Trackback]

    […] There you will find 77826 additional Information to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  3. nova88 Says:
    March 30th, 2022 at 22:55

    … [Trackback]

    […] Read More to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  4. สล็อตวอเลท ไม่มีขั้นต่ำ Says:
    April 19th, 2022 at 01:57

    … [Trackback]

    […] There you can find 61417 additional Information on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  5. buy dumps online Says:
    April 22nd, 2022 at 11:19

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  6. ถาดกระดาษ Says:
    May 13th, 2022 at 18:45

    … [Trackback]

    […] Information on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  7. cc dumps shop Says:
    July 9th, 2022 at 20:29

    … [Trackback]

    […] Find More Info here on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  8. Bonuses Says:
    July 31st, 2022 at 17:07

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  9. this page Says:
    August 23rd, 2022 at 16:58

    … [Trackback]

    […] Find More Info here to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  10. sbo Says:
    September 29th, 2022 at 19:40

    … [Trackback]

    […] Here you can find 81047 additional Information to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  11. อนิเมะพากย์ไทย Says:
    November 30th, 2022 at 09:16

    … [Trackback]

    […] Find More Info here to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  12. สมัครแทงบอล Says:
    December 16th, 2022 at 18:17

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  13. ww.mp3juices.io Says:
    February 11th, 2023 at 02:59

    … [Trackback]

    […] Read More Info here on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  14. event filming company Says:
    February 13th, 2023 at 18:26

    … [Trackback]

    […] Find More to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  15. Tucson Bariatric Surgeon Says:
    February 18th, 2023 at 15:58

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

  16. Buy DMT Powder Online New South Wales Says:
    March 11th, 2023 at 19:18

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]

Comments