« WordPress author email blacklist patch | Home | DOMNodeList as an Array »
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:
- English – UTF-8, windows-1252, ISO-8859-1
- Chinese, Simplified – GB2312
- Chinese, Traditional – Big5
- Spanish – ISO-8859-1, windows-1252
- French – windows-1252, ISO-8859-1
- German – windows-1252, ISO-8859-1
- Greek – windows-1253, ISO-8859-7
- Arabic – ISO-8859-6
- Hebrew – windows-1255
- Romanian – ISO-8856-16
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 | 11 Comments »
July 7th, 2024 at 04:22
… [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/ […]
July 26th, 2024 at 21:39
… [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/ […]
August 20th, 2024 at 19:37
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
August 20th, 2024 at 23:00
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
September 3rd, 2024 at 20:16
… [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/ […]
September 14th, 2024 at 20:18
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
September 20th, 2024 at 23:09
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
September 24th, 2024 at 00:59
… [Trackback]
[…] Read More here on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
September 24th, 2024 at 22:13
… [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/ […]
September 26th, 2024 at 01:13
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]
September 28th, 2024 at 04:23
… [Trackback]
[…] Read More here on that Topic: compdigitec.com/labs/2008/08/30/the-gtk-critical-gtk_text_buffer_emit_insert-assertion-warning-in-php-gtk2/ […]