Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Created November 11, 2012 15:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikeabdullah/4055259 to your computer and use it in GitHub Desktop.
Save mikeabdullah/4055259 to your computer and use it in GitHub Desktop.
Using WebKit to encode unescaped URL strings
- (NSURL *)URLFromString:(NSString *)string;
{
static NSPasteboard *pboard;
if (!pboard) pboard = [[NSPasteboard pasteboardWithUniqueName] retain];
[pboard clearContents];
[pboard writeObjects:@[string]];
NSURL *result = [WebView URLFromPasteboard:pboard];
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment