From ef3e6ce06b7bcf413d59949f2cfa650a1772d8c8 Mon Sep 17 00:00:00 2001 From: James Little Date: Wed, 22 Jun 2016 09:03:57 -0400 Subject: [PATCH] Fix #115, wiki search special chars --- lib/RAMP/Wiki/Wikiator.php | 5 ++--- script/ingest_wiki.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/RAMP/Wiki/Wikiator.php b/lib/RAMP/Wiki/Wikiator.php index d6d7932..abf7b84 100644 --- a/lib/RAMP/Wiki/Wikiator.php +++ b/lib/RAMP/Wiki/Wikiator.php @@ -404,10 +404,9 @@ private function setupCurl() */ static function encodeForUrl($lstrString) { - $lstrString = preg_replace('/\s\s+/', " ", $lstrString ); - $lstrString = rawurlencode(utf8_decode($lstrString)); - return $lstrString; + + return urlencode(trim($lstrString)); } /** diff --git a/script/ingest_wiki.js b/script/ingest_wiki.js index 32c9359..2e5d893 100644 --- a/script/ingest_wiki.js +++ b/script/ingest_wiki.js @@ -297,14 +297,14 @@ function getLocalWikiMarkup(eacId) { function autoSearchWikipedia(entityName) { - lstrUserSearch = encode_utf8(entityName); + var lstrUserSearch = entityName; showLoadingImage(); //post to ajax wiki controller to search wiki and get results $.post('ajax/wiki_api.php', {'action': 'search', 'title': lstrUserSearch}, function (response) { try { - lobjData = JSON.parse(response); + var lobjData = JSON.parse(response); } catch (e) { renderFlashMessage('

' + e.message + '

');