[MacRuby-devel] [MacRuby] #737: Unpack inconsistencies (possibly related to issue #605?)

MacRuby ruby-noreply at macosforge.org
Sat Jun 5 17:31:07 PDT 2010


#737: Unpack inconsistencies (possibly related to issue #605?)
---------------------------------+------------------------------------------
 Reporter:  babs.devs@…          |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  major                |   Milestone:                       
Component:  MacRuby              |    Keywords:  Grit, unpack         
---------------------------------+------------------------------------------

Comment(by vincent.isambart@…):

 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/>



More information about the MacRuby-devel mailing list