From: FUJIMOTO H. <hi...@im...> - 2003-03-16 00:57:44
|
At Sat, 15 Mar 2003 18:14:25 -0500, Hi, Sam Roberts wrote: > Hi, just started working with ruby cocoa, and am having a lot of fun. > Why does OSX::NSData.to_s return a ruby String that looks like "<xxxxxx > xxxxxx>" (where x are hex digits)? I didn't expect this: NSObject#to_s (and NSData#to_s) is same as `NSData.description.cString'. The following code snippet may be what you want except it is too verbose. vcdata = OSX::ABAddressBook.sharedAddressBook.me.vCardRepresentation enc = NSProprietaryStringEncoding # specify an appropriate encoding. str = OSX::NSString.alloc.initWithData_encoding( vcdata, enc ) or str = ' ' * vcdata.length vcdata.getBytes(str) str RubyCocoa is implemented like this currently. However, I recognize that behavior of such implementation is not so good. -- FUJIMOTO Hisakuni |