Something-else-than-utf8 bug (was: Re: utf8 bug ?)



On Sat, Sep 04, 2004 at 10:25:20 -0400, muppet wrote:
-=-=-=-=-=-=-=-=-=-=-=-=-
homie:~$ ~/tmp/perl585/bin/perl
use Gtk2 '-init';
my $string='string';
my $label=Gtk2::Label->new($string);
$_='a %1 b %1';
s/%1/replace($string)/eg;
warn $_;

sub replace
{       $_=shift;
        return $_;
}

panic: sv_pos_b2u: bad byte offset at - line 5.
-=-=-=-=-=-=-=-=-=-=-=-=-

Hell, perl handling of utf8 is *broken*!

1) If I insert 'use utf8;' in the first line, the error does NOT go
   away.
2) If I insert 'use utf8;' in the first line and comment out the
   Gtk2::Label->new, the error DOES go away.
3) If I insert 'use utf8;' and actualy use a non-ascii in $string, the
   problem DOES go away -- the label is still there!

Now, the error obviously has something to do with the Gtk2 typemap.
Without calling Gtk2::Label->new($string), there is no problem.

But what is strange is, that it makes a difference whether $string
actualy contains a non-ascii character.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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