Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid URL-string as NSUrl becomes null

another issue where I seem to have found an solution for ObjC but not MonoTouch.

I want a NSUrl from an URL (as string).

The string may contain whitespace and backslashes.

Why is NSUrl returning null for such string, even though these are valid urls in a browser?

For example: NSUrl foo = NSUrl.FromString(@"http://google.com/search?\query");

foo == null

Any suggestions?

like image 939
Mike Avatar asked Apr 21 '10 18:04

Mike


1 Answers

[NSURL URLWithString:[googlSearchString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];

Referenced by
Stack Overflow....

like image 100
Suresh D Avatar answered Oct 28 '22 23:10

Suresh D