• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: printing arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing arrays


  • Subject: Re: printing arrays
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 02 Nov 2012 10:35:01 -0700

On Fri, Nov 2, 2012, at 10:02 AM, Gerriet M. Denkmann wrote:
> This code:
>
> NSString *key = @"กุญแจ";
> NSString *value = @"คุณค่า";
> NSArray *array = @[ key, value ];
> NSLog(@" Two nice strings: %@ %@", key, value);
> NSLog(@" Bad Array: %@", array);
>
> prints:
>
> 2012-...]  Two nice strings: กุญแจ คุณค่า
> 2012-...]  Bad Array: (
>     "\U0e01\U0e38\U0e0d\U0e41\U0e08",
>     "\U0e04\U0e38\U0e13\U0e04\U0e48\U0e32"
> )
>
> Bug or feature?
> Is there a way to make the array print in a more readable way?
> 10.8.2, Xcode 4.5.2
>
> Gerriet.
>
> P.S. Same problem with dictionaries.
>
> P.P.S
> NSLog(@" Bad Array3: %s", [[array description] UTF8String]); has exactly
> the same unreadable output.

Hopefully you're not relying on NSLog or -description producing reliable
information. It can change at any time, in any OS release. A lot of iOS
developers were caught off-guard when -[NSDate description] changed what
format it used.

If this is just for debugging purposes, you could swizzle -[NSArray
description] and -[NSDictionary description]. Either way, file a bug.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: printing arrays
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >printing arrays (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: is this possible in iOS with constraints?
  • Next by Date: Re: is this possible in iOS with constraints?
  • Previous by thread: printing arrays
  • Next by thread: Re: printing arrays
  • Index(es):
    • Date
    • Thread