String#pack and String#unpack use Big Endian instead of Native Endian
---------------------------------------------------------------------
Key: JRUBY-1728
URL: http://jira.codehaus.org/browse/JRUBY-1728
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1b1
Environment: ruby 1.8.6 vs jruby 1.1b1
Reporter: Rutger Nijlunsing
String#pack and String#unpack use Big Endian for Native Endian instead of
Little Endian on i386.
Ruby's String#pack does not have a way to specify 'Little Endian', but only
'Native Endian' and 'Network Byte Order' (== Big Endian).
On i386 class machines, Native Endian equal Little Endian and not Big Endian.
This bug makes parsers of file formats specified in Little Endian fail.
Ruby 1.8.6 gives:
irb(main):002:0> [12].pack("S")
=> "\f\000"
irb(main):003:0> [12].pack("l")
=> "\f\000\000\000"
irb(main):007:0> [12].pack("i")
=> "\f\000\000\000"
irb(main):008:0> [12].pack("f")
=> "[EMAIL PROTECTED]"
...while JRuby gives the reverse:
jirb(main):001:0> [12].pack("s")
=> "\000\f"
jirb(main):002:0> [12].pack("l")
=> "\000\000\000\f"
jirb(main):005:0> [12].pack("i")
=> "\000\000\000\f"
jirb(main):006:0> [12].pack("f")
=> "[EMAIL PROTECTED]"
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email