#737: Unpack inconsistencies (possibly related to issue #605?)
---------------------------------+------------------------------------------
Reporter: babs.d...@… | Owner: lsansone...@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords: Grit, unpack
---------------------------------+------------------------------------------
Comment(by vincent.isamb...@…):
In this sample code the difference is that MacRuby handles all Ruby files
as encoded in UTF-8, whereas Ruby 1.9 handles them as ASCII-8BIT by
default. To have 1.9 behave as MacRuby, you can add "# coding: UTF-8" to
the first line of the Ruby file.
Currently the only way to have it behave as you want is indeed to replace
'PACK_IDX_SIGNATURE = "\377tOc"' by 'PACK_IDX_SIGNATURE =
"\377tOc".force_encoding(Encoding::BINARY)'. This might not be very clean
but it will work in any implementation of Ruby 1.9.
Alternatively you can also do PACK_IDX_SIGNATURE = [0xff, 0x74, 0x4f,
0x63].pack('C*')
--
Ticket URL: <http://www.macruby.org/trac/ticket/737#comment:4>
MacRuby <http://macruby.org/>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel