Re: URL Escaping weirdness
Re: URL Escaping weirdness
- Subject: Re: URL Escaping weirdness
- From: Ricky Sharp <email@hidden>
- Date: Sat, 26 Mar 2005 16:33:25 -0600
On Mar 26, 2005, at 3:57 PM, Michael Terence Mulligan wrote:
So I added an NSString category with a number of URL/web-centric
methods,
one of them being:
-(NSString *)escapeURL
{
CFURLCreateStringByAddingPercentEscapes(0, self, 0, @"+&",
kCFStringEncodingUTF8);
}
I believe the problem is with the fourth parameter. I don't know what
the compiler will generate if you pass in @"+&" to a function that
takes a CFStringRef even though CFString and NSString are toll-free
bridged. Perhaps pass CFSTR("+&") instead.
Also, rather than passing in 0 for the first parameter, pass in NULL or
kCFAllocatorDefault. The third parameter should also be a NULL. While
0 will work, it's always better, IMO, to use named constants or
nil/NULL.
Finally, I believe the actual implementation of the function returns
the string?
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden