AnyEvent::IRC::Client has trouble with utf8
AnyEvent-IRC 0.95
This is perl 5, version 12, subversion 1 (v5.12.1) built for i686-linux
Linux hostname 2.6.31.12-rt21-1-686 #1 SMP PREEMPT RT Fri Feb 19
15:39:59 UTC 2010 i686 GNU/Linux
I have attached a .pl file that is slightly modified from the synopsis
for AnyEvent::IRC::Client, which demonstrates the buggy behavior. Here
is the output:
kunwon1@hostname:~/title$ ./bug.pl
unhandled callback exception on event (send,
AnyEvent::IRC::Client=HASH(0xa01c760), ARRAY(0xa2b9fc0)): Wide character in
subroutine entry at
/home/kunwon1/perl5/lib/site_perl/5.12.1/AnyEvent/Handle.pm line 927.
Sent message!
I'm in!
I'm out!
I'm out!
the source file is recognized as english utf8 text by the `file` utility
Subject: | bug.pl |
#!/home/kunwon1/perl5/bin/perl
use AnyEvent;
use AnyEvent::IRC::Client;
use utf8;
my $c = AnyEvent->condvar;
my $timer;
my $con = new AnyEvent::IRC::Client;
$con->reg_cb (connect => sub {
my ($con, $err) = @_;
if (defined $err) {
warn "connect error: $err\n";
return;
}
});
$con->reg_cb (registered => sub { print "I'm in!\n"; });
$con->reg_cb (disconnect => sub { print "I'm out!\n"; $c->broadcast });
$con->reg_cb (
sent => sub {
my ($con) = @_;
if ($_[2] eq 'PRIVMSG') {
print "Sent message!\n";
$timer = AnyEvent->timer (
after => 1,
cb => sub {
undef $timer;
$con->disconnect ('done')
}
);
}
}
);
$con->send_srv (
PRIVMSG => 'kunwon1',
"ââ«"
);
$con->connect ("irc.freenode.net", 6667, { nick => 'alskjdfisd' });
$c->wait;
$con->disconnect;