com gtk/php-gtk: Override for set_text() to fix UTF 8 issue: ext/scintilla/scintilla.overrides

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    17f0448a251241a8317ed9e9b0d7c217cae878ba
Author:    Anant Narayanan <[email protected]>         Wed, 7 Jun 2006 10:05:23 +0000
Parents:   00365e5b996ba569f81c945c41e861946bb4fbc6
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=17f0448a251241a8317ed9e9b0d7c217cae878ba

Log:
Override for set_text() to fix UTF8 issue

Changed paths:
  M  ext/scintilla/scintilla.overrides


Diff:
17f0448a251241a8317ed9e9b0d7c217cae878ba
diff --git a/ext/scintilla/scintilla.overrides b/ext/scintilla/scintilla.overrides
index df35661..3d9a29f 100644
--- a/ext/scintilla/scintilla.overrides
+++ b/ext/scintilla/scintilla.overrides
@@ -37,3 +37,31 @@ PHP_METHOD
 
     efree(text);
 }
+
+%%
+override gtk_scintilla_set_text
+PHP_METHOD
+{
+    char *utf8;
+    gchar *text;
+
+    zend_bool free_utf8 = FALSE;
+    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);
+
+    if (text && free_text) {
+        gtk_scintilla_set_text(GTK_SCINTILLA(PHPG_GOBJECT(this_ptr)), text);
+        g_free(text);
+    }
+
+    if (free_utf8)
+        g_free(text);
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.