• 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: NUL characters in NSString cause unexpected results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NUL characters in NSString cause unexpected results (From: Jerry Krinock <email@hidden>)
 >Re: NUL characters in NSString cause unexpected results (From: Scott Stevenson <email@hidden>)
 >Re: NUL characters in NSString cause unexpected results (From: Rosyna <email@hidden>)
 >Re: NUL characters in NSString cause unexpected results (From: Scott Stevenson <email@hidden>)
 >Re: NUL characters in NSString cause unexpected results (From: Rosyna <email@hidden>)

  • Prev by Date: Re: NSProgressIndicator drawing
  • Next by Date: Re: NSProgressIndicator drawing
  • Previous by thread: Re: NUL characters in NSString cause unexpected results
  • Next by thread: Re: NUL characters in NSString cause unexpected results
  • Index(es):
    • Date
    • Thread