URL Encoding
URL Encoding
- Subject: URL Encoding
- From: "Mike Chambers" <email@hidden>
- Date: Wed, 31 Oct 2007 15:07:08 -0700
I am trying to figure out how to properly URL Encode Urls in Objective-C
Cocoa.
I know this has been discussed before, and doing a quick search, I came
across:
CFURLCreateStringByAddingPercentEscapes
with an example from here:
http://www.cocoabuilder.com/archive/message/cocoa/2001/12/16/16098
+(NSString *) urlencode: (NSString *) url
{
NSString* out = [(NSString*)
CFURLCreateStringByAddingPercentEscapes(NULL,
(CFStringRef) url,
NULL,
NULL, kCFStringEncodingUTF8)
autorelease];
return out;
}
I have tried multiple examples of this, but it does not encode my URLs.
I ended up writing my own method to do this (which works):
http://mesh.typepad.com/blog/2007/10/url-encoding-wi.html#more
but I have this sneaking suspicion there is a better way.
So, how should I url encode urls within Cocoa?
thanks for any input / insight...
mike chambers
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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