diff --git a/searx/engines/bing.py b/searx/engines/bing.py index b2ad7b6cf..15c8ee611 100644 --- a/searx/engines/bing.py +++ b/searx/engines/bing.py @@ -33,8 +33,11 @@ def request(query, params): offset = (params['pageno'] - 1) * 10 + 1 if params['language'] != 'all': - query = u'language:{} {}'.format(params['language'].split('-')[0].upper(), - query.decode('utf-8')).encode('utf-8') + lang = params['language'].split('-')[0].upper() + else: + lang = 'EN' + + query = u'language:{} {}'.format(lang, query.decode('utf-8')).encode('utf-8') search_path = search_string.format( query=urlencode({'q': query}), diff --git a/tests/unit/engines/test_bing.py b/tests/unit/engines/test_bing.py index 61f8629d0..a63b2e333 100644 --- a/tests/unit/engines/test_bing.py +++ b/tests/unit/engines/test_bing.py @@ -19,7 +19,7 @@ class TestBingEngine(SearxTestCase): dicto['language'] = 'all' params = bing.request(query, dicto) - self.assertTrue('language' not in params['url']) + self.assertTrue('language' in params['url']) def test_response(self): self.assertRaises(AttributeError, bing.response, None)