• 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: string encoding in NSMutableData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: string encoding in NSMutableData
      • From: John Stiles <email@hidden>
References: 
 >Re: string encoding in NSMutableData (From: "Paolo Manna" <email@hidden>)
 >Re: string encoding in NSMutableData (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Problem with PDFDocument initWithURL method
  • Next by Date: minimum one entity instance on initial launch
  • Previous by thread: Re: string encoding in NSMutableData
  • Next by thread: Re: string encoding in NSMutableData
  • Index(es):
    • Date
    • Thread