[MacRuby-devel] NSString.to_data

Robert Rice rice.audio at pobox.com
Mon Apr 18 13:06:37 PDT 2011


Using the Scripting Bridge to process e_mails, the bridge return NSString rather than String class when reading the message content. This works fine except that the .to_data method is undefined for NSString. I am able to use dataUsingEncoding as in the following:

content		= message.content.get # Returns NSString rather than String 
nsdata		= content.dataUsingEncoding( NSASCIIStringEncoding )
nsdata.writeToURL( @url, atomically:true )

But for consistency, you may want to add the .to_data method to the NSString class.

Thanks,
Bob Rice

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110418/e4c200d7/attachment.html>


More information about the MacRuby-devel mailing list