develooper Front page | perl.perl5.porters | Postings from May 2013

Re: How on earth did we manage to break pack() so badly?

Thread Previous | Thread Next
Steffen Mueller
May 1, 2013 16:42
Re: How on earth did we manage to break pack() so badly?
Message ID:
On 05/01/2013 05:22 PM, Dave Mitchell wrote:
> I think the issue can be summed up as:
> * Some of those fixes have clashes withg your mental model of how pack
>    should work.

I disagree...

a  A string with arbitrary binary data, will be null padded.
A  A text (ASCII) string, will be space padded.

... because I fail to see how $out = pack("v/a", $stuff) (same for v/A) 
should ever have $out have the UTF8 flag set given the above.

I appreciate that you already said you consider the particular behaviour 
a bug, but I read that as "the fact that the UTF8ness of the output 
breaks your length integer is a bug" not "that should never result in a 
scalar with the utf8 flag set". The following paragraph assumes that 
understanding of what you said:

IOW, is there any reason why pack() would ever result in a scalar with 
the UTF8 bit set? I don't think so. pack() will create a series of bytes 
(well, octets), not characters because an arbitrary combination of pack 
templates will always produce something that mixes in output that isn't 
based on characters.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About