Re: dumb NSLog question
Re: dumb NSLog question
- Subject: Re: dumb NSLog question
- From: Lester Dowling <email@hidden>
- Date: Mon, 9 Jan 2006 12:27:59 +1100
On 09/01/2006, at 12:10 PM, Matt Neuburg wrote:
Why doesn't this code work?
NSString* tmChar = [[NSString alloc] initWithBytes:"\xE2\x84\xA2"
length:3 encoding:NSUTF8StringEncoding];
NSLog(@"%@",tmChar);
The debugger shows that tmChar is a tm character. But nothing is
logged. Why
not?
Here's another take on the same thing. This works:
NSLog(@"hey: %@",tmChar);
So what's making the difference? Thx - I feel like I've asked this
before
but I'm afraid I've forgotten the answer. m.
'Tis the bletcherous bug of wrong length.
Change the length from 3 to 4:
NSString *tmChar = [[NSString alloc] initWithBytes:"\xE2\x84\xA2"
length:4 // Include the terminating null.
encoding:NSUTF8StringEncoding
];
Now it works without making hey:
2006-01-09 12:26:21.306 tmlog[537] ™
-- Lester
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden