[MacRuby] #887: calling join on an Array of BINARY Strings returns UTF-8, may raise Encoding::CompatibilityError.
MacRuby
ruby-noreply at macosforge.org
Wed Sep 8 03:19:45 PDT 2010
#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 at 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/>
More information about the macruby-tickets
mailing list