Re: Problems with special characters and insert-text on Gtk2::Entry



On 2/25/07, Christian Jodar <tian c-sait net> wrote:
I have a problem with Gtk2::Entry when I connect a callback to insert-text
signal. All the special characters I could enter (I tested with é or à in
french) are replaced with 2 characters ("Ã(c)" or "Ã"). It looks like a UTF-8
encoding problem.

This doesn't occur when removing the callback. I am using Gtk2-Perl 1.140.
There is below a small example that shows this.

Is this a known problem that has been fixed in a newer release and/or is there
a workaround?

There's a bug in the cusom marshaller for the insert-text signal for
GtkEditables:
it doesn't mark the parameter new_text as UTF8 when passed in,
but does so when passing it out (if you return an empty list).
Suggested fix below
(bug is still present in Gtk2 1.143).

Cheers, Roderich

--- libgtk2-perl-1.143-ORIG/xs/GtkEditable.xs   2007-02-27
13:39:40.000000000 +0100
+++ libgtk2-perl-1.143/xs/GtkEditable.xs        2007-02-27
13:46:03.000000000 +0100
@@ -60,7 +60,7 @@
       GPERL_CLOSURE_MARSHAL_PUSH_INSTANCE (param_values);

       /* new_text */
-       string = newSVpv (g_value_get_string (param_values+1), 0);
+       string = newSVGChar (g_value_get_string (param_values+1));
       XPUSHs (string);

       /* text length is redundant, but documented.  it doesn't hurt



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]