Re: URL Escaping weirdness
Re: URL Escaping weirdness
- Subject: Re: URL Escaping weirdness
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 26 Mar 2005 15:24:42 -0800
On Mar 26, 2005, at 1:57 PM, Michael Terence Mulligan wrote:
-(NSString *)escapeURL
{
CFURLCreateStringByAddingPercentEscapes(0, self, 0, @"+&",
kCFStringEncodingUTF8);
}
Presumably:
return CFURL...
However, it fails really simple test cases, i.e. (notice the space in
"news story")
NSLog([@"www.example.com/news story/index.htm" escapeURL]);
this SHOULD output:
"www.example.com/news story/index.htm"
but in reality, it outputs:
"www.example.com/news tory/index.htm"
(in case the email gets processed in a funny way, there are about
twenty
spaces after "news" and notice that the "s" in "story" is missing)
The "about twenty spaces" "has something to do with" the " " in the
string.
Contrast:
NSString *url = @"http://www.example.com/news story/index.htm";
NSLog(@"url %@", url);
NSLog([url escapeURL]);
NSLog(@"[url escapeURL] %@", [url escapeURL]);
url http://www.example.com/news story/index.htm
http://www.example.com/news P(tory/index.htm
[url escapeURL] http://www.example.com/news story/index.htm
mmalc
_______________________________________________
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