[MacRuby] #887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError.
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ {{{ ### Ruby 1.9.2 s = "a".force_encoding("BINARY") # => "a" s.encoding # => #<Encoding:ASCII-8BIT> [s, s].join.encoding # => #<Encoding:ASCII-8BIT> s = "\xA4\x01".force_encoding("BINARY") # => "\xA4\x01" s.encoding # => #<Encoding:ASCII-8BIT> [s, s].join.encoding # => #<Encoding:ASCII-8BIT> ### MacRuby 0.7 trunk@4494 s = "a".force_encoding("BINARY") # => "a" s.encoding # => #<Encoding:ASCII-8BIT> [s, s].join.encoding # => #<Encoding:UTF-8> s = "\xA4\x01".force_encoding("BINARY") # => "\xA4\x01" s.encoding # => #<Encoding:ASCII-8BIT> [s, s].join.encoding # Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/887> MacRuby <http://macruby.org/>
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * milestone: MacRuby 0.7 => Comment: Indeed, looks like our #join does not honor the operands encoding. Aah, joy. -- Ticket URL: <http://www.macruby.org/trac/ticket/887#comment:1> MacRuby <http://macruby.org/>
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): Actually, it looks like MacRuby returns UTF-8 because that's what we use by default. If you add a magic comment to specify UTF-8 ruby 1.9 will behave the same. I am not sure if this is really a bug. -- Ticket URL: <http://www.macruby.org/trac/ticket/887#comment:2> MacRuby <http://macruby.org/>
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by dev@…): That's not true. {{{ #!/usr/bin/env ruby # encoding: UTF-8 s = "a".force_encoding("BINARY") puts s.encoding puts [s, s].join.encoding s = "\xA4\x01".force_encoding("BINARY") puts s.encoding puts [s, s].join.encoding }}} Gives me {{{ ASCII-8BIT ASCII-8BIT ASCII-8BIT ASCII-8BIT }}} With ruby 1.9.2p0 (2010-08-18 revision 29034) [universal.x86_64-darwin10.4.0] -- Ticket URL: <http://www.macruby.org/trac/ticket/887#comment:4> MacRuby <http://macruby.org/>
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Changes (by watson1978@…): * milestone: => MacRuby 1.0 -- Ticket URL: <http://www.macruby.org/trac/ticket/887#comment:5> MacRuby <http://macruby.org/>
#887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError. ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 1.0 => MacRuby 0.8 Comment: The problem seems to be fixed with r4982. -- Ticket URL: <http://www.macruby.org/trac/ticket/887#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby