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
On Mon, Apr 18, 2011 at 22:06, Robert Rice <rice.audio@pobox.com> wrote:
But for consistency, you may want to add the .to_data method to the NSString
See the recent thread "Hash Table", it explains the funny business going on. I also posted something to discuss this general matter a few months ago but don't really remember if it got any traction (think not). I guess it approached this via NSArray. You don't need to use dataUsingEncoding, you can just convert that to a ruby string instead. Many ways to do that come to me: String(foo) String.new(foo) "".replace(foo) ""<<foo ""+foo
participants (2)
-
Caio Chassot
-
Robert Rice