Re: utf8 bug ?

On Thu, 2004-09-02 at 17:19, Quentin wrote:
Setting a label (or something else, works with a treestore) with a perl
variable, change the encoding of the perl variable to utf8.

use Gtk2 '-init';
my $string='a string';
warn '$string is '.(utf8::is_utf8($string)? '':'not ')."utf8";
my $label=Gtk2::Label->new($string);
warn '$string is '.(utf8::is_utf8($string)? '':'not ')."utf8";

this sample code outputs :
$string is not utf8 at line 3.
$string is utf8 at line 5.

the code causing this is in Glib typemap:


        /* same as SvGChar(), but not in a function */
        sv_utf8_upgrade ($arg);
        $var = ($type)SvPV_nolen ($arg);

the sv_utf8_upgrade is the culprit. i'm not sure whether or not to call
this a bug though.


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