[MacRuby-devel] Unexpected results when using strings with encoding functions

Steve Clarke steve at sclarkes.me.uk
Tue Sep 27 12:09:23 PDT 2011


Hi,

I've just spent a long time being puzzled by the following behavior.

I have a String (I thought).  When I tried to use 

my_string.encode(..) 

I got a NoMethodError exception.

I only finally realised what was happening when I subsequently did 

my_string.force_encoding(...).  

In this case I get a helpful exception telling me that force_encoding is not supported for NSStrings.

It would be very helpful if encode failed in the same way - or even created a ruby String under the covers?

Steve







More information about the MacRuby-devel mailing list