diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2020-07-11 10:17:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-11 12:17:06 +0200 |
commit | f9faafa89698f0f32f2a6dc34473c6e33f82092d (patch) | |
tree | 7e6f2dc7532612d8c273401b2e3bf3e4c8db7cba /utils | |
parent | 7b19e6c5f49767a0d30453ad2947c0f2844e8eb0 (diff) | |
download | searxng-f9faafa89698f0f32f2a6dc34473c6e33f82092d.tar.gz searxng-f9faafa89698f0f32f2a6dc34473c6e33f82092d.zip |
[fix] external_bang - UnicodeDecodeError: 'ascii' codec can't decode (#2043)
Python's default encoding depends on the platform, set (python) default encoding
UTF-8 in uwsgi ini files:
LANG=C.UTF-8
LANGUAGE=C.UTF-8
LC_ALL=C.UTF-8
Error pattern:
Traceback (most recent call last):
File "/usr/local/searx/searx-src/searx/webapp.py", line 74, in <module>
from searx.search import SearchWithPlugins, get_search_query_from_webapp
File "/usr/local/searx/searx-src/searx/search.py", line 32, in <module>
from searx.external_bang import get_bang_url
File "/usr/local/searx/searx-src/searx/external_bang.py", line 13, in <module>
for bang in json.load(json_file)['bang']:
File "/usr/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 31341: ordinal not in range(128)
close: https://github.com/asciimoo/searx/issues/2041
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils')
4 files changed, 20 insertions, 0 deletions
diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini index 51f659d0f..9dd2e6f2f 100644 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini +++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini @@ -9,6 +9,11 @@ uid = ${SERVICE_USER} gid = ${SERVICE_GROUP} +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + # chdir to specified directory before apps loading chdir = ${SEARX_SRC}/searx diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket index eeabb3715..1a0fda913 100644 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket +++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket @@ -9,6 +9,11 @@ uid = ${SERVICE_USER} gid = ${SERVICE_GROUP} +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + # chdir to specified directory before apps loading chdir = ${SEARX_SRC}/searx diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searx.ini index 9785d7cd1..b1c56e412 100644 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini +++ b/utils/templates/etc/uwsgi/apps-available/searx.ini @@ -9,6 +9,11 @@ uid = ${SERVICE_USER} gid = ${SERVICE_GROUP} +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + # chdir to specified directory before apps loading chdir = ${SEARX_SRC}/searx diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket b/utils/templates/etc/uwsgi/apps-available/searx.ini:socket index 88436e5eb..9cb292102 100644 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket +++ b/utils/templates/etc/uwsgi/apps-available/searx.ini:socket @@ -9,6 +9,11 @@ uid = ${SERVICE_USER} gid = ${SERVICE_GROUP} +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + # chdir to specified directory before apps loading chdir = ${SEARX_SRC}/searx |