Re: [Php-Gtk2] GtkTextView and accented letter
| From: | Steph Fox | Date: | Sat, 02 Sep 2006 12:47:07 +0000 |
| Subject: | Re: [Php-Gtk2] GtkTextView and accented letter | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7213@lists.php.net to get a copy of this message | ||
Hi Marco,
What is your code-page setting (in php.ini)?
- Steph
----- Original Message ----- From: "ThePeg" <marco.pegoraro@gmail.com>
To: <php-gtk-general@lists.php.net>
Sent: Saturday, September 02, 2006 2:48 PM
Subject: [PHP-GTK] [Php-Gtk2] GtkTextView and accented letter
Hi all,
I'm new in developing with php-gtk2 and glade.
I'm italian so my english is not very well.
I have a problem while getting text from a GtkTextBuffer of a GtkTextView
control: if I write any accented letters or some special chars like "£" the
script crash!
With normal characters i can read and use the text as I want.
I'll post my code:
--------------
$txt = $app->get_widget('txt'); // $app is my glade istance.
$buff = $txt->get_buffer();
$text = $buff->get_text($buff->get_start_iter(), $bff->get_end_iter());
$dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO,
Gtk::BUTTONS_CLOSE, $text);
$dialog->run();
$dialog->destroy();
--------------
I try to use only a GtkTextBuffer setting into it a "malicious" text like
"ThePeg è nuovo" (italian translation for: ThePeg is new) and write to a
file the text buffer content:
--------------
$buff = new GtkTextBuffer();
$buff->set_text("ThePeg è nuovo");
$text = $buff->get_text($buff->get_start_iter(), $bff->get_end_iter());
$f = fopen('temp.txt', 'w');
fwrite($f, $text);
fclose($f);
--------------
It work fine without crash and without corrupt characters with strange
encoding....
I try to show a dialog with the "malicious" text instead of write it to a
file:
--------------
$buff = new GtkTextBuffer();
$buff->set_text("ThePeg è nuovo");
$text = $buff->get_text($buff->get_start_iter(), $bff->get_end_iter());
$dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO,
Gtk::BUTTONS_CLOSE, $text);
$dialog->run();
$dialog->destroy();
--------------
Character "è" will be corrupted by strange encoding...
I need help!
Thanks!
--
View this message in context:
http://www.nabble.com/-Php-Gtk2--GtkTextView-and-accented-letter-tf2206985.html#a6112409
Sent from the Php - GTK - General forum at Nabble.com.
--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ NOD32 1.1380 (20060125) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com