-1

When I print a String array to the log most of the Strings show up like they're suppose to, but sometimes the show like this:

\U200e\U05d3\U05d5\U05e8\U05d9\U05ea \U05dc\U05d5\U05d9\U200e    

What is causing this problem?

Omer
  • 221
  • 3
  • 13

1 Answers1

0

When you log an array with NSLog, or when you log an NSArray with print, you are relying on Cocoa's logging. It's very old so it represents a non-ASCII string by showing its codepoints.

If you don't like that, log with Swift's print and make sure you are logging a Swift Array, not an NSArray.

let s = "\u{200e}\u{05d3}\u{05d5}\u{05e8}\u{05d9}\u{05ea}"
NSLog("%@",[s])       // Cocoa is logging
print([s] as NSArray) // Cocoa is logging
print([s])            // Swift is logging
matt
  • 515,959
  • 87
  • 875
  • 1,141