diff options
author | Adam Tauber <asciimoo@gmail.com> | 2019-10-16 14:52:57 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2019-10-16 14:52:57 +0200 |
commit | 72459b246be8dbf7f237b48677b0dfecb60d43ef (patch) | |
tree | 5d8b937186a0b1a08fe6ae96a1a26b32eeff0053 /searx/utils.py | |
parent | 7177c9e12f238aeac66e450ee94c849c927dd407 (diff) | |
download | searxng-72459b246be8dbf7f237b48677b0dfecb60d43ef.tar.gz searxng-72459b246be8dbf7f237b48677b0dfecb60d43ef.zip |
[fix] convert bytes type to string in language detection (fixes dictzone)
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/utils.py b/searx/utils.py index d88bc9897..eb5da2fa7 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -308,14 +308,15 @@ def int_or_zero(num): def is_valid_lang(lang): is_abbr = (len(lang) == 2) + lang = lang.lower().decode('utf-8') if is_abbr: for l in language_codes: - if l[0][:2] == lang.lower(): + if l[0][:2] == lang: return (True, l[0][:2], l[3].lower()) return False else: for l in language_codes: - if l[1].lower() == lang.lower(): + if l[1].lower() == lang or l[3].lower() == lang: return (True, l[0][:2], l[3].lower()) return False |