develooper Front page | perl.perl5.porters | Postings from January 2012

Re: pack and ASCII

Thread Previous | Thread Next
Leon Timmermans
January 9, 2012 12:31
Re: pack and ASCII
Message ID:
On Mon, Jan 9, 2012 at 8:55 PM, Eric Brine <> wrote:
> C<< pack 'A*' >> correctly packs all strings of bytes (whether UTF8=0 or
> UTF8=1). I don't see why it's a bug that it usefully works for characters
> that aren't bytes too. Are you using C<< pack 'A*' >> to validate your data?
> You can use one of the following to do that:

Is also means that «pack "A1", $foo» can't be relied upon to be only
one byte, which means a whole extra layer of validation is necessary.
I find it even more troublesome that pack 'a1' is having the same
issue, despite being documented as «string with arbitrary binary

Quite frankly, I think we absolutely need a for pack formats that have
strong guarantees on number of octets, preferably by the name 'a'.


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