hi everybody !
i've encoutered a strange bug with method stringWithContentsOfURL: from class NSString.
i pass it a completly valid URL, but it returns garbage string instead of a valid html page content...
the url is this one :
as you can see it perfectly works in Safari
Now a short piece of Code :
NSURL *requestURL = [NSURL URLWithString:@"http://ypng.infospace.com/home/yellow-pages/redir.htm?top=internal&fromform=qsearch&wqhqn=&qhq n=Geotopia&qc=&qs="];
NSString* returnedHTML = [NSString stringWithContentsOfURL:requestURL];
NSLog(@"look at this strange string: %@",returnedHTML);
[returnedHTML writeToFile:@"/path/to/a/garbage/html/file.html" atomically:YES];
NSLog(@"the URL is not RFC compliant...");
now just look at the content of file.html...
can anybody explain me why it is only garbage ?
first i thought it was an encoding problem, so i tried using NSData then change the encoding etc... but no way to make this works !
Can it be a problem with basic browser/Server communication (i know VERY little about http protocol...) : i mean, that maybe the http server wants to dialog with the "client" part of the NSStringWithContentsOfURL because it needs some informations (?), but what's behind this method does not manage this type of communication ? (i remember GET etc...)
please, can i have an explanation on this, and better, a solution !!! :-D