print() behavior difference, working as designed.

While working on making some adjustments to code that has been developed for OSX/iOS that would allow it to be portable to Linux, we are seeing a behavior that is causing some confusion. I’m not sure it is a bug, it may well be working as designed.

At issue the following code: (where value is an UnsafeMutablePointer<void> containing a pointer to a MacOSRomanStringEncoding of the string ‘hello’)

let data : NSData = NSData.init(bytes:value, length:len)
    let s : String = String.init(data:data,
      encoding:NSMacOSRomanStringEncoding)!
    print("Value: \(s)")

On OSX, this results in a print of:

Are the NS classes ported to Linux?

···

--
This is my signature. There are many like it, but this one is mine.

On Dec 17, 2015, at 08:27, Dru Satori via swift-users <swift-users@swift.org> wrote:

let data : NSData = NSData.init(bytes:value, length:len)
     let s : String = String.init(data:data,
         encoding:NSMacOSRomanStringEncoding)!
     print("Value: \(s)")

Some of the Foundation classes. NSData is tagged as ‘mostly implemented’

···

On 12/17/15, 12:17 PM, "swift-users-bounces@swift.org on behalf of @lbutlr via swift-users" <swift-users-bounces@swift.org on behalf of swift-users@swift.org> wrote:

Are the NS classes ported to Linux?

--
This is my signature. There are many like it, but this one is mine.

On Dec 17, 2015, at 08:27, Dru Satori via swift-users <swift-users@swift.org> wrote:

let data : NSData = NSData.init(bytes:value, length:len)
     let s : String = String.init(data:data,
         encoding:NSMacOSRomanStringEncoding)!
     print("Value: \(s)")

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users