[MacRuby-devel] [MacRuby] #737: Unpack inconsistencies (possibly related to issue #605?)
MacRuby
ruby-noreply at macosforge.org
Sat Jun 5 09:01:05 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 babs.devs@…):
Replying to [comment:2 macruby@…]:
> This might be down to the encodings, what encoding do you get the
constant and packed string? The packed string I believe will be using the
BINARY or ASCII-8BIT encoding, in order to compare the two strings you
might need to use :force_encoding on the constant, provided its a Ruby
string and not an NSString.
Yep. The Constant was encoded as UTF-8 and the packed string was ASCII-
8BIT. This alleviated the problem:
{{{
PACK_IDX_SIGNATURE.force_encoding(Encoding::ASCII_8BIT)
}}}
From what I've read, the encoding in Ruby 1.9 was the culprit here. Is
this a common issue? :force_encoding seems a bit hackish, is there a "best
practice" way to ensure consistent encoding in Ruby?
--
Ticket URL: <http://www.macruby.org/trac/ticket/737#comment:3>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list