[epiphany/gnome-2-28] Encode the typed URL before passing it as a query string for searching



commit aeab7566a454a50cc65b127e4bda6e614e341118
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Sun Oct 4 12:55:49 2009 +0100

    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 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ea44421..4bd007b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1124,9 +1124,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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]