From 5b06a4ef9b8b2d9cc18f18c4ff6cfddf632f7483 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Mon, 16 Jul 2018 21:14:46 +0530 Subject: Fix url handling --- src/content.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/content.rs b/src/content.rs index 13582f1..b72f4a8 100644 --- a/src/content.rs +++ b/src/content.rs @@ -2,6 +2,7 @@ extern crate reqwest; extern crate serde_json; extern crate cursive; extern crate regex; +extern crate urlencoding; use cursive::theme::Effect; use cursive::utils::markup::StyledString; @@ -19,7 +20,7 @@ pub fn query_url_gen(title: &str) -> String { url.push_str("prop=extracts%7Clinks&"); url.push_str("indexpageids=1&"); url.push_str("titles="); - url.push_str(title); + url.push_str(&urlencoding::encode(title)); url.push_str("&"); url.push_str("redirects=1&"); url.push_str("pllimit=40&"); @@ -35,7 +36,7 @@ pub fn search_url_gen(search: &str) -> String { url.push_str("action=opensearch&"); url.push_str("format=json&"); url.push_str("search="); - url.push_str(search); + url.push_str(&urlencoding::encode(search)); url.push_str("&"); url.push_str("limit=20"); url -- cgit v1.2.3