in reply to Re: use bytes vs packed data
in thread use bytes vs packed data

Interesting, it seems it would be but when I turn off use bytes and add use encoding::warnings I get the incorrect behavior with no warnings.

The code fragment where this is happening is as follows, in case it helps. $conn is a Net::RabbitMQ connection object. $params is a FCGI parameters hash. $packed_data is the string that is getting munged.

my $s = YAML::Dump($params); print "pack length " . length($s) . "\n"; my $packed_data = pack("N/aN/a", $s, $in); $conn->publish($channel, "rpc.$function", $packed_data, { exchange => $exchange_name }, { content_type => $type, correlation_id => $uuid_str, reply_to => $queue_name, });

Replies are listed 'Best First'.
Re^3: use bytes vs packed data
by John M. Dlugosz (Monsignor) on May 04, 2011 at 02:05 UTC
    There is a function to find out whether the string is stored as utf8 or 8-bit, but I can't remember what it's called. You might try exploring the different values and see.
        I thought there was some kind of scalar util library version, too.

        The Encode you referenced also explains how encoded/decoded strings are so-marked, so it would be good for the OP to go over. And it mentions "As of perl 5.8.1, utf8 also has utf8::is_utf8().