Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Malformed UTF-8 char when publishing in Net::AMQP::RabbitMQ

by perl_help26 (Beadle)
on Jul 08, 2016 at 15:09 UTC ( [id://1167467]=perlquestion: print w/replies, xml ) Need Help??

perl_help26 has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
In the below code, when i use Net::RabbitMQ, the recieved result is correct BUT when I use Net::AMQP::RabbitMQ, I get this error:
"Malformed UTF-8 character (overflow at 0xfff0d3f5f0d3f5c2, byte 0x00, after start byte 0xff) in unpack" and the result is all mixed up! Do these modules have different encodings? Any idea on what is happening there? Thanks

my $type=2; my $key=85170777777; my $bin = pack('Cx7Q',$type,$key); my $res = $me->{mq}->publish(1, "nc.look", $bin, {exchange=>'nc'}, {re +ply_to => $me->{replyQ},}); $res = $me->{mq}->recv(); print Dumper $res;

Replies are listed 'Best First'.
Re: Malformed UTF-8 char when publishing in Net::AMQP::RabbitMQ
by ikegami (Patriarch) on Jul 08, 2016 at 19:52 UTC

    I'll take a look at it. Please provide the version of Net::AMQP::RabbitMQ, and the output of use Devel::Peek; Dump($bin); Dump($res->{body});

      The version of the Net::AMQP::RabbitMQ is 2.200000. The output of the lines you provided are:
      SV = NULL(0x0) at 0xd9b5f0 REFCNT = 1 FLAGS = () SV = PVLV(0xda5d30) at 0xd7efd0 REFCNT = 1 FLAGS = (TEMP,GMG,SMG) IV = 0 NV = 0 PV = 0 MAGIC = 0xdab340 MG_VIRTUAL = &PL_vtbl_defelem MG_TYPE = PERL_MAGIC_defelem(y) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0xd7eb98 SV = PV(0xd7cb78) at 0xd7eb98 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xdab730 "body"\0 CUR = 4 LEN = 8 TYPE = y TARGOFF = 0 TARGLEN = 1 TARG = 0xd7ed48 SV = PVHV(0xd84f90) at 0xd7ed48 REFCNT = 2 FLAGS = (SHAREKEYS) ARRAY = 0x0 KEYS = 0 FILL = 0 MAX = 7 RITER = -1 EITER = 0x0
      I also noticed that the publish method takes in props : content_type => $string and content_encoding => $string. Could it be that Net::RabbitMQ has default encoding UTF8 but Net::AMQP::RabbitMQ doesnt? And if so how can I specify so that it uses UTF8? What do you think?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1167467]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found