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

Re: pack and ASCII

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
January 13, 2012 14:46
Subject:
Re: pack and ASCII
Message ID:
CAHhgV8hRvmeCyVsakGeUwiyGPBWTiWTz8+rkCwk9NiWJegUDFQ@mail.gmail.com
On Fri, Jan 13, 2012 at 11:17 PM, Eric Brine <ikegami@adaelis.com> wrote:
> No, encoding the output of C<pack> would produce garbage, e.g. C<< pack("N",
> 0x80112233) >> would return 5 bytes instead of 4.

I have no idea what you're talking about here. Can you please stop
interpreting anything anyone else says in the most unreasonable way
possible?

> Maybe you meanting encoding the input of C<< pack "A" >>, but that would
> break C<< pack("A20", $byte) >> and change C<< pack("A20", $text) >> in an
> incompatible way.

Well, obviously I didn't mean to encode bytes (why would anyone try
that?), and I don't see how encode breaks $text more than downgrading
would. And it's not like anyone still wants latin-1.

> hum? C<< pack "a" >> has always been very useful. It's used to build C
> structs and fixed-width records, for starters.

Obviously, I mean the behavior of «pack "a", $char»; I think I've been
quite explicit about liking its byte semantics. Is there any use case
for character semantics in that case? I can't think of it, at all.

Leon

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About