From 9b82cb1908e2e879ba8fcd067cdfb073c5839932 Mon Sep 17 00:00:00 2001 From: potato Date: Thu, 15 Jun 2017 10:51:09 +0200 Subject: [PATCH] [fix] is_valid_lang fixed for new languages.py + dictzone engine encoding --- searx/engines/dictzone.py | 2 +- searx/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/engines/dictzone.py b/searx/engines/dictzone.py index 7c347862..7cc44df7 100644 --- a/searx/engines/dictzone.py +++ b/searx/engines/dictzone.py @@ -37,7 +37,7 @@ def request(query, params): params['url'] = url.format(from_lang=from_lang[2], to_lang=to_lang[2], - query=query) + query=query.decode('utf-8')) return params diff --git a/searx/utils.py b/searx/utils.py index 498f8d0b..3df57116 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -295,12 +295,12 @@ def is_valid_lang(lang): if is_abbr: for l in language_codes: if l[0][:2] == lang.lower(): - return (True, l[0][:2], l[1].lower()) + return (True, l[0][:2], l[3].lower()) return False else: for l in language_codes: if l[1].lower() == lang.lower(): - return (True, l[0][:2], l[1].lower()) + return (True, l[0][:2], l[3].lower()) return False