Re: NUL characters in NSString cause unexpected results
Re: NUL characters in NSString cause unexpected results
- Subject: Re: NUL characters in NSString cause unexpected results
- From: Steve Christensen <email@hidden>
- Date: Thu, 23 Nov 2006 16:33:34 -0800
On Nov 23, 2006, at 11:58 AM, Rosyna wrote:
Ack, at 11/23/06, Scott Stevenson said:
On Nov 22, 2006, at 11:09 PM, Rosyna wrote:
That's odd since it just calls CFStringCreateWithBytes() and
CFStringCreateWithBytes() has no such note. Bizarre.
Perhaps it's a bit ambiguous, but:
"This function creates an immutable CFString object from a "raw"
byte buffer-that is,
a buffer containing 8-bit characters but no length byte (as in
Pascal buffers) and no
terminating NULL character (as in C buffers)"
<http://developer.apple.com/documentation/CoreFoundation/Reference/
CFStringRef/Reference/reference.html>
I guess you could take that to mean "no NULLs" (more likely) or
"the NULL doesn't mean the end."
I took it to mean the latter since it says bytes and there's
CFStringCreateWithCString which does care about NULL.
CFStringCreateWithBytes takes a buffer that's numBytes long and
converts it into a CFString based on the specified encoding. I've
used CFStringCreateWithBytes to, for example, convert a wchar string
into a CFString.
steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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