Re: GtkTextView and Euro Symbol -> segfault

From: Date: Fri, 17 Nov 2006 09:22:21 +0000
Subject: Re: GtkTextView and Euro Symbol -> segfault
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7478@lists.php.net to get a copy of this message
Yes for sure it helps, thanks! Now i can get the text without segfault (Still a big bug imho), but i get an error when i try to insert the text i get from the first buffer to another: (RExpEd.php:3541): Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed As you can see this happen when setting codepage to utf-8 here's the code that give me this error function runRExp(){ global $buf_text,$buf_exp,$buf_view; # get text to recog $str = $buf_text->get_text($buf_text->get_start_iter(),$buf_text->get_end_iter()); $exp = $buf_exp->get_text($buf_exp->get_start_iter(), $buf_exp->get_end_iter()); # apply regexp if(! preg_match_all($exp,$str,$m,PREG_SET_ORDER) ){ $view = "no match found"; }else{ $view = var_export($m,1); } # print result $buf_view->set_text($view); } If someone can explain me what is wrong i would appreciate. Thanks and regards, nathan
I had similar problems. When getting the text string from a GtkTextBuffer or a GtkEntry, I would get a crash if there were certain characters involved, amongst others the euro symbol. The point here is that gtk uses utf-8 internally for all text. If your system character set is not utf-8, when you get a text string from a widget it has to be transcoded. In my case, the php-gtk.codepage setting in my php.ini was wrong - it was set to iso-8859-1 but on my windows box I should have set it to CP1252. If your system can use utf-8 (not unlikely on linux) set the php- gtk.codepage to utf-8, otherwise you may try iso-8859-15 (which includes the euro symbol, while iso-8859-1 does not). Hope this helps. -- André =========================================================== Black Holes were created when God divided by zero. -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- -- le savoir ne vaut que s'il est partagé par tous --

« previous php.gtk.general (#7478) next »