From eb4d86050b88de7b29ff07ee59780994f02cc3cf Mon Sep 17 00:00:00 2001 From: Gustavo Noronha Silva Date: Sun, 4 Oct 2009 12:55:49 +0100 Subject: Encode the typed URL before passing it as a query string for searching This change makes sure that all characters that are typed make it to the search query. Thanks to Dan Winship for pointing out the solution. Bug #596717 --- embed/ephy-web-view.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'embed/ephy-web-view.c') diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 3d16eab0a..acf3e5f0b 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1110,9 +1110,12 @@ ephy_web_view_load_url (EphyWebView *view, /* If the string doesn't look like an URI, let's search it; */ if (soup_uri == NULL && priv->non_search_regex && - !g_regex_match (priv->non_search_regex, url, 0, NULL)) - effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), url); - else + !g_regex_match (priv->non_search_regex, url, 0, NULL)) { + char *query_param = soup_form_encode ("q", url, NULL); + /* + 2 here is getting rid of 'q=' */ + effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), query_param + 2); + g_free (query_param); + } else effective_url = ephy_embed_utils_normalize_address (url); webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url); -- cgit v1.2.3