logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: php-gtk /ext/gtk+ gtk.overrides: msg#00039

Subject: cvs: php-gtk /ext/gtk+ gtk.overrides
andrei          Sun Feb 12 20:50:18 2006 UTC

  Modified files:              
    /php-gtk/ext/gtk+   gtk.overrides 
  Log:
  Fix UTF-8 issues.
  
  
http://cvs.php.net/viewcvs.cgi/php-gtk/ext/gtk+/gtk.overrides?r1=1.151&r2=1.152&diff_format=u
Index: php-gtk/ext/gtk+/gtk.overrides
diff -u php-gtk/ext/gtk+/gtk.overrides:1.151 
php-gtk/ext/gtk+/gtk.overrides:1.152
--- php-gtk/ext/gtk+/gtk.overrides:1.151        Sun Feb  5 08:56:35 2006
+++ php-gtk/ext/gtk+/gtk.overrides      Sun Feb 12 20:50:18 2006
@@ -650,13 +650,26 @@
 {
     char *stock_id;
     GtkStockItem item;
+    gchar *cp = NULL;
+    gsize cp_len = 0;
+    zend_bool free_cp = FALSE;
 
     if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s", &stock_id))
         return;
 
     if (gtk_stock_lookup(stock_id, &item)) {
+        cp = phpg_from_utf8(item.label, strlen(item.label), &cp_len, &free_cp 
TSRMLS_CC);
+        if (cp) {
+            item.label = cp;
+        } else {
+            php_error(E_WARNING, "Could not convert item label from UTF-8");
+            return;
+        }
         php_gtk_build_value(&return_value, "(ssiis)", item.stock_id, 
item.label,
                             item.modifier, item.keyval, 
item.translation_domain);
+        if (free_cp) {
+            g_free(cp);
+        }
     } else {
         return;
     }

-- 
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>