Re: [NSString characterAtIndex:] -> [NSString stringWithCString:encoding:]
Re: [NSString characterAtIndex:] -> [NSString stringWithCString:encoding:]
- Subject: Re: [NSString characterAtIndex:] -> [NSString stringWithCString:encoding:]
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 1 Mar 2010 16:01:01 -0700
On Mar 1, 2010, at 10:25 AM, Gabriel Fernandez wrote:
> if I change the encoding: to ascii, I get one character in the new NSString, as I'd expect, but with Unicode encoding, I get no characters - WHY?!
The method you're using takes a buffer of 1-byte characters, not 2-byte characters. Use +stringWithCharacters:length: if you need to deal with 2-byte Unicode characters.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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