Skip to content

Instantly share code, notes, and snippets.

@pburleson
Forked from mikeabdullah/gist:4055259
Created November 15, 2012 16:42
Show Gist options
  • Save pburleson/4079642 to your computer and use it in GitHub Desktop.
Save pburleson/4079642 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