mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[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>
			
			
This commit is contained in:
		
							parent
							
								
									7b19e6c5f4
								
							
						
					
					
						commit
						f9faafa896
					
				
					 4 changed files with 20 additions and 0 deletions
				
			
		|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Markus Heiser
						Markus Heiser