[MacRuby] #1156: Data read using a file opened with "b" should be in ASCII-8BIT
#1156: Data read using a file opened with "b" should be in ASCII-8BIT ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Files opened with the "b" flag should have their data read in ASCII-8BIT (binary), but in MacRuby the encoding is always UTF-8: {{{ $ cat e.rb # coding: UTF-8 p File.open($0, "rb").read.encoding $ ruby -v e.rb ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0] #<Encoding:ASCII-8BIT> $ macruby -v e.rb MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64] #<Encoding:UTF-8> }}} It would be even better if an encoding could be given to {{{File.open}}}: {{{ $ cat e.rb # coding: utf-8 p File.open($0, "rb", :encoding => "ISO-8859-1").read.encoding $ ruby -v e.rb ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0] #<Encoding:ISO-8859-1> $ macruby -v e.rb MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64] e.rb:2:in `<main>': can't convert Hash into Integer (TypeError) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1156> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby