IOS NSLog error with Unicode characters

Can someone tell me the reason for the discrepancy for the following results?

completionHandler:^(NSArray *placemarks, NSError *error) {
    NSLog(@"\n placemarks%@", placemarks);

RESULT OF:

placemarks(
"\U039b\U03b5\U03c9\U03c6\U03cc\U03c1\U03bf\U03c2 \U039a\U03cd\U03c0\U03c1\U03bf\U03c5 163, 16451 \U0391\U03c1\U03b3\U03c5\U03c1\U03bf\U03cd\U03c0\U03bf\U03bb\U03b7\U03c2, \U0395\U03bb\U03bb\U03ac\U03c2 @ <+37.90085408,+23.75654648> +/- 100.00m, region (identifier <+37.90085408,+23.75654648> radius 141.62) <+37.90085408,+23.75654648> radius 141.62m"
)

and

for(id object in placemarks ) {NSLog(@"%@ \n", object);}

Resultant

2012-09-14 13:08:23.493 ΑΦΜ[1390:c07] Λεωφόρος Κύπρου 163, 16451 Αργυρούπολης, Ελλάς @ <+37.90085408,+23.75654648> +/- 100.00m, region (identifier <+37.90085408,+23.75654648> radius 141.62) <+37.90085408,+23.75654648> radius 141.62m 

thank

+5
source share
2 answers

Interesting:)

Transfer %@to a format string NSLogsimply means "call descriptionfor the facility."

It doesn't seem descriptionto NSArraybe dealing with unicode characters other than descriptionfor each object.

However, I suspect that the description method NSArraydoes not simply call up a description for each of the objects it contains, and then, for some reason, I'm not 100% sure it encodes them before uploading them to NSLog.

+6
source

%@ NSLog [NSArray description] . NSArray , [NSArray description] " , , ". Unicode NSNonLossyASCIIStringEncoding. NSArray , .

completionHandler:^(NSArray *placemarks, NSError *error) {
       NSLog(@"%@", [NSString stringWithCString:[[placemarks description] cStringUsingEncoding:NSASCIIStringEncoding] encoding:NSNonLossyASCIIStringEncoding]);

\Uxxxx c, c NSString NSNonLossyASCIIStringEncoding, [NSLog description]. c.

+3

All Articles