Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing unicode in the console in the right format

NSSet *subFolders = [_account subscribedFolders];
NSLog(@"subFolders: %@",subFolders);

Output:

...
    "[Gmail]/\U05d8\U05d9\U05d5\U05d8\U05d5\U05ea",
    "[Gmail]/\U05d7\U05e9\U05d5\U05d1" 
...

Is there any way I can show the above text in its original language (Hebrew) ?

Things I tried:

  • changing the debugger from LLDB to GDB - Didn't work
  • Checking under preferences -> Text Editing UTF-* is selected

Thanks

like image 908
Segev Avatar asked Oct 21 '22 12:10

Segev


1 Answers

There is no issue with displaying unicode characters in the console, so I would assume it's the way the string is getting into the set in the first place.

I would suggest iterating over all the objects inside subFolders with something like:

 for( id object in [subFolders allObjects] ) {
    //Print out the name of the item explicitly
 }

Even if this doesn't work, it at least lets you work with the strings directly. If it's still printing out:

"[Gmail]/\U05d8\U05d9\U05d5\U05d8\U05d5\U05ea"

It would look as if you're being sent escaped unicode characters, and I would suggest this: https://stackoverflow.com/a/7861345/352891 - this may work directly on NSSet's description

like image 140
user352891 Avatar answered Oct 24 '22 04:10

user352891