Re: string encoding in NSMutableData
Re: string encoding in NSMutableData
- Subject: Re: string encoding in NSMutableData
- From: Jaime Magiera <email@hidden>
- Date: Wed, 8 Aug 2007 15:09:48 -0400
On Aug 8, 2007, at 1:04 PM, Alastair Houghton wrote:
On 8 Aug 2007, at 17:34, Paolo Manna wrote:
output = [NSMutableData dataWithBytes:[key cStringUsingEncoding:
NSUnicodeStringEncoding]
length:4];
}
Instead of what I expect, the result is...
a9006100
Which appears to be the string, but with lots of padding :)
Yes, Unicode in this context is synonym for UTF-16, i.e. 16 bits per
char:
It may seem minor, but UTF-16 is *not* 16-bits per character. It's
16-bits per code unit. The difference matters with combining
characters and surrogate pairs. (There is also the issue of what
exactly you consider to be a character, which can be a little
involved for e.g. Indic scripts.)
Cool, thanks for the direction and clarification. That gives me a
good launching point.
Jaime
Jaime Magiera
Sensory Research Network
http://www.sensoryresearch.net
_______________________________________________
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