about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEdd Barrett <vext01@gmail.com>2011-01-28 16:12:22 +0000
committerEdd Barrett <vext01@gmail.com>2011-01-28 16:12:22 +0000
commitfd4c32a5975692bff0247f2a1975eacc302f6225 (patch)
tree43598868a3c53211082428ebaaf91faf7f6eccc8
parent4735aa520073100f0815b548b84bed2f9f429bbf (diff)
downloadxombrero-fd4c32a5975692bff0247f2a1975eacc302f6225.tar.gz
urlencode search terms (including reserved characters) so that you can search
for 'C#' or 'C++' for example.

OK marco
-rw-r--r--xxxterm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 5c28131..9d453e8 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -295,6 +295,7 @@ struct karg {
 				"</style>\n\n"
 #define XT_MAX_URL_LENGTH	(4096) /* 1 page is atomic, don't make bigger */
 #define XT_MAX_UNDO_CLOSE_TAB	(32)
+#define XT_RESERVED_CHARS	"$&+,/:;=?@ \"<>#%%{}|^~[]`"
 
 /* file sizes */
 #define SZ_KB		((uint64_t) 1024)
@@ -4631,6 +4632,7 @@ activate_search_entry_cb(GtkWidget* entry, struct tab *t)
 {
 	const gchar		*search = gtk_entry_get_text(GTK_ENTRY(entry));
 	char			*newuri = NULL;
+	gchar			*enc_search;
 
 	DNPRINTF(XT_D_URL, "activate_search_entry_cb: %s\n", search);
 
@@ -4642,7 +4644,9 @@ activate_search_entry_cb(GtkWidget* entry, struct tab *t)
 		return;
 	}
 
-	newuri = g_strdup_printf(search_string, search);
+	enc_search = soup_uri_encode(search, XT_RESERVED_CHARS);
+	newuri = g_strdup_printf(search_string, enc_search);
+	g_free(enc_search);
 
 	webkit_web_view_load_uri(t->wv, newuri);
 	gtk_widget_grab_focus(GTK_WIDGET(t->wv));