Re: HTML-encoded characters mucking up my NSStrings
Re: HTML-encoded characters mucking up my NSStrings
- Subject: Re: HTML-encoded characters mucking up my NSStrings
- From: Dustin Voss <email@hidden>
- Date: Tue, 10 Feb 2004 17:58:12 -0800
On 10 Feb, 2004, at 4:15 PM, Kyle Moffett wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Feb 10, 2004, at 18:22, Dustin Voss wrote:
CFStringRef unescapedCF = CFXMLCreateStringByUnescapingEntities
(NULL, (CFStringRef) htmlString, NULL);
NSString *unescaped = [NSString stringWithString: (NSString *)
unescapedCF];
CFRelease (unescapedCF);
Why bother with the extra string? CFStringRef and NSString * are
Toll-Free bridged
NSString *noEntities = (NSString
*)CFXMLCreateStringByUnescapingEntities (NULL,
(CFStringRef)withEntities, NULL);
Note, noEntities is *not* autoreleased, you need to autorelease or
release it when done.
You are right, of course, but I don't like the idea of calling
"retain", "release", or "autorelease" on CF references, even if they
are toll-free bridged. There might be zones or something that screws
that up. Or maybe I'm just overly paranoid... :)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.