inessential by Brent Simmons

URL-encoding in Cocoa

I was going ape looking for a URL-encoding method in Cocoa. To my surprise it appears to lack one.

So this post is here for the search engines. Cocoa developers: you can call CFURLCreateStringByAddingPercentEscapes in the CoreFoundation framework to URL-encode a string. It takes (and returns) CFStringRefs, which are apparently interchangeable with NSStrings.