Skip Menu |
 

This queue is for tickets about the AnyEvent-IRC CPAN distribution.

Report information
The Basics
Id: 60837
Status: rejected
Priority: 0/
Queue: AnyEvent-IRC

People
Owner: Nobody in particular
Requestors: david [...] dklb.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.95
Fixed in: (no value)



Download (untitled) / with headers
text/plain 753b
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
Download bug.pl
text/x-perl 814b
#!/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;
Subject: Re: [rt.cpan.org #60837]
Date: Tue, 21 Sep 2010 09:44:20 +0200
To: kunwon1 via RT <bug-AnyEvent-IRC [...] rt.cpan.org>
From: Robin Redeker <elmex [...] ta-sa.org>
Download (untitled) / with headers
text/plain 1.7k
Hi! Sorry for the delay. Was quite busy the last weeks. On Sat, Aug 28, 2010 at 12:57:59PM -0400, kunwon1 via RT wrote: Show quoted text
> Sat Aug 28 12:57:58 2010: Request 60837 was acted upon. > Transaction: Ticket created by david@dklb.org > Queue: AnyEvent-IRC > Subject: (No subject given) > Broken in: 0.95 > Severity: Important > Owner: Nobody > Requestors: david@dklb.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60837 > > > > 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
The Problem is, that you feed AnyEvent::IRC a Unicode text, which is not supported by IRC. You have to use something like this: $con->send_srv (PRIVMSG => 'kunwon1', encode ('utf-8', $unicodestring)); Your source text might be utf-8 encoded, but the "use utf8" prama tells Perl to decode the utf-8 strings to unicode strings. Greetings, Robin -- Robin Redeker | Deliantra, the free code+content MORPG elmex@ta-sa.org / r.redeker@gmail.com | http://www.deliantra.net http://www.ta-sa.org/ |


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.