From: Brian Mitchell Date: 2005-05-24T03:46:59+09:00 Subject: Re: Endian packing errors. On 5/23/05, Jim Freeze wrote: > * Brian Mitchell [2005-05-24 03:25:24 +0900]: > > > On 5/23/05, Jim Freeze wrote: > > > * Brian Mitchell [2005-05-24 02:53:52 +0900]: > > > > > > > I have a number I must convert to a network long. I have been using > > > > this thus far with success: > > > > > > > > [number].pack("N") > > > > > > > > for 65 it should return "\000\000\000A". It does so on my linux boxes, > > > > an iMac with 10.3 but on my Powerbook with 10.4 it returns the reverse > > > > "A\000\000\000". What is causing this. Did Apple mess up yet again > > > > with including ruby? Could someone duplicate this on tiger? > > On my PowerBook with Ruby 1.8.2, I get: > > irb(main):001:0> [65].pack('N') > => "\000\000\000A" > irb(main):002:0> [65].pack('n') > => "\000A" > > The "A\000\000\000" is not making sense to me. > Sorry I don't have Tiger installed to compare with. > I think that is what it is. I just compiled ruby from source to check (actually just miniruby) and it does not have the problem. I am submitting a bug report to apple. It looks like there is yet another problem with ruby on tiger. It may be with the ruby patcher that I installed but I have not had time to verify that with a clean install. Anyone with a fresh tiger install want to try it out? Brian.