PDA

View Full Version : Google search string




undrdev
Oct 20, 2009, 10:44 AM
Hi everyone. I'm making web browser with the webkit framework and objective-c. My attempt to integrate google search in the browser - just like in Safari, Firefox, etc, ended with failure. After performing many searches, I couldn't find a solution. Is there any known or unknown solution on this problem?
Thanks in advance :)



robbieduncan
Oct 20, 2009, 10:50 AM
What, exactly, is the problem? What have you tried? What didn't work (errors? unexpected behaviour?)?

undrdev
Oct 20, 2009, 11:07 AM
The problem is with the string itself. I mean nowhere is explained how to form a google string with a given search words. "http://www.google.com/search?q=" is the beginning. Afterwards there is no explanation how to form the rest of the string. If we have "google search" as a string, how to put these two words after the google.com/... :?

lee1210
Oct 20, 2009, 11:16 AM
google%20search

just escape your string as a URL.
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/stringByAddingPercentEscapesUsingEncoding:

-Lee

undrdev
Oct 20, 2009, 01:02 PM
Thanks. Works like a charm :)