[MacRuby-devel] Strings Differ between Ruby and MacRuby?

Shaun August shaun at eoslightmedia.com
Mon Oct 11 12:07:15 PDT 2010


I have a bit of an issue with Strings between MacRuby and Ruby.

I have a socket that is feeding me data and I am running a check on watching for changes in the byte structure. The script works in ruby and I can get both the "\030" and the "\220" values to test true

Here is the snippet. 

if results == "\030"
         puts "got $2"
        # @nc.postNotificationName("coins_taken_complete", object:self)
                  
       elsif results == "\220"
         puts "got $1"
        # @nc.postNotificationName("coins_taken_complete", object:self)
end

When I get it into the MacRuby environment the "\030" is picked up by the code but the "\220" is not picked up at all. I have also tried this with the hex values  "\x18" and "\x90" and I get the same result, the "\x18" is picked up and the "\x90" is not. I can see in the console that "\x90" is the value being passed to this test when building with xcode and as I mentioned when I build the script in ruby with textmate everything functions normally. 

So I am wondering two things:
Is this a bug? 
If I have to do a work around is there any way to tell what encodings are being seen by the Macruby loop so I can match them

Any help would be greatly appreciated

Thanks,

Shaun



More information about the MacRuby-devel mailing list