Re: utf8 issues in Scintilla(again)
| From: | Anant Narayanan | Date: | Tue, 04 Jul 2006 05:54:19 +0000 |
| Subject: | Re: utf8 issues in Scintilla(again) | ||
| References: | 1 2 3 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-3187@lists.php.net to get a copy of this message | ||
Hi Fernando,
Consider this test script:
<?php
$sc = new GtkScintilla();
$sc->set_size_request(200,200);
$sc->set_text("ééé´ Sequência inválida na entrada de conversão");
$w = new GtkWindow();
$w->add($sc);
$w->show_all();
$w->connect_simple('destroy', array('Gtk', 'main_quit'));
Gtk::main();
?>
Applying your patch (i.e. without converting to PHP from UTF8) I get the
following as output (http://www.kix.in/php-gtk2/invalid.png):
ééé´ Sequência inválida na entrada de conversão
which is obviously not what we expect to see. While, my method of
conversion gives me the correct output
(http://www.kix.in/php-gtk2/valid.png):
ééé´ Sequência inválida na entrada de conversão
I have reason to believe that Scintilla does not expect UTF8 encoded
strings, and that arguments passed to set_text() will almost all the
time be UTF8. Hence your patch would fail for cases where the parameters
to set_text() are indeed UTF8 encoded (like the example above).
However, in your case, since you are passing a PHP variable to
set_text(), it has already been converted from UTF8 to a native PHP type.
What we need is a conditional conversion statement that handles both
test cases. Eliminating the conversion statement is not an option. I
have some pressing work for the next few days, and will look into a
proper solution for this ASAP. Meanwhile, if you can come up with a
patch that handles both the test scripts, that would be great.
Once again, Thanks for everything!
Best Regards,
- Anant