Re: utf8 issues in Scintilla(again)
| From: | Andrei Zmievski | Date: | Tue, 04 Jul 2006 16:57:58 +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-3189@lists.php.net to get a copy of this message | ||
Does Scintilla operate in UTF-8 internally or not? If yes, then we do need to convert the text to UTF-8 form (which is done incorrectly here with "s" specifier). If no, then we should just pass the string straight on.
-Andrei
On Jul 3, 2006, at 9:08 PM, Fernando Correa da Conceição wrote:
The error message is in Brazilian Portuguese. What it tell is that there is a byte sequence invalid in the input chars for the conversion. so look at this: # is my comment PHP_METHOD {char *utf8; #dont need gchar *text;zend_bool free_utf8 = FALSE; #dont need zend_bool free_text = FALSE;gsize len = 0;NOT_STATIC_METHOD();if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s", &utf8, &free_utf8)) return; text = phpg_from_utf8(utf8, strlen(utf8), &len, &free_text TSRMLS_CC); #the above line is wrong! the utf8 var here comes from a php variable, so it is not encoded in utf8, but it is a plain string. We need this for values that comes from gtk, not the ones that comes from php, so since it is not encoded in utf8 it contains character like áã which is invalid for a utf8encoded string, so it generates a fatal exception.# the fix is simple: do not make this!if (text && free_text) { gtk_scintilla_set_text(GTK_SCINTILLA(PHPG_GOBJECT(this_ptr)), text); g_free(text); }if (free_utf8) g_free(utf8);}