prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [flickr_noapi] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
  Similar to #419
  
  Installation: current master commit
  How to reproduce? Search for "kek" on https://search.snopyta.org/ and click on "Images"
  
  ```
  ERROR:flask.app:Exception on / [POST]
  Traceback (most recent call last):
    File "/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
      response = self.full_dispatch_request()
    File "/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
      rv = self.dispatch_request()
    File "/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/usr/local/searx/searx/webapp.py", line 544, in index
      result['title'] = highlight_content(escape(result['title'] or u''), search_query.query)
    File "/usr/local/searx/searx/utils.py", line 79, in highlight_content
      if content.lower().find(query.lower()) > -1:
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `searx/engines/flickr_noapi.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 
  3 """
  4   Flickr (Images)
  5 
  6  @website     https://www.flickr.com
  7  @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html)
  8 
  9  @using-api   no
  10  @results     HTML
  11  @stable      no
  12  @parse       url, title, thumbnail, img_src
  13 """
  14 
  15 from json import loads
  16 from time import time
  17 import re
  18 from searx.engines import logger
  19 from searx.url_utils import urlencode
  20 from searx.utils import ecma_unescape, html_to_text
  21 
  22 logger = logger.getChild('flickr-noapi')
  23 
  24 categories = ['images']
  25 
  26 url = 'https://www.flickr.com/'
  27 search_url = url + 'search?{query}&page={page}'
  28 time_range_url = '&min_upload_date={start}&max_upload_date={end}'
  29 photo_url = 'https://www.flickr.com/photos/{userid}/{photoid}'
  30 modelexport_re = re.compile(r"^\s*modelExport:\s*({.*}),$", re.M)
  31 image_sizes = ('o', 'k', 'h', 'b', 'c', 'z', 'n', 'm', 't', 'q', 's')
  32 
  33 paging = True
  34 time_range_support = True
  35 time_range_dict = {'day': 60 * 60 * 24,
  36                    'week': 60 * 60 * 24 * 7,
  37                    'month': 60 * 60 * 24 * 7 * 4,
  38                    'year': 60 * 60 * 24 * 7 * 52}
  39 
  40 
  41 def build_flickr_url(user_id, photo_id):
  42     return photo_url.format(userid=user_id, photoid=photo_id)
  43 
  44 
  45 def _get_time_range_url(time_range):
  46     if time_range in time_range_dict:
  47         return time_range_url.format(start=time(), end=str(int(time()) - time_range_dict[time_range]))
  48     return ''
  49 
  50 
  51 def request(query, params):
  52     params['url'] = (search_url.format(query=urlencode({'text': query}), page=params['pageno'])
  53                      + _get_time_range_url(params['time_range']))
  54     return params
  55 
  56 
  57 def response(resp):
  58     results = []
  59 
  60     matches = modelexport_re.search(resp.text)
  61 
  62     if matches is None:
  63         return results
  64 
  65     match = matches.group(1)
  66     model_export = loads(match)
  67 
  68     if 'legend' not in model_export:
  69         return results
  70 
  71     legend = model_export['legend']
  72 
  73     # handle empty page
  74     if not legend or not legend[0]:
  75         return results
  76 
  77     for index in legend:
  78         photo = model_export['main'][index[0]][int(index[1])][index[2]][index[3]][int(index[4])]
  79         author = ecma_unescape(photo.get('realname', ''))
  80         source = ecma_unescape(photo.get('username', '')) + ' @ Flickr'
  81         title = ecma_unescape(photo.get('title', ''))
  82         content = html_to_text(ecma_unescape(photo.get('description', '')))
  83         img_src = None
  84         # From the biggest to the lowest format
  85         for image_size in image_sizes:
  86             if image_size in photo['sizes']:
  87                 img_src = photo['sizes'][image_size]['url']
  88                 img_format = 'jpg ' \
  89                     + str(photo['sizes'][image_size]['width']) \
  90                     + 'x' \
  91                     + str(photo['sizes'][image_size]['height'])
  92                 break
  93 
  94         if not img_src:
  95             logger.debug('cannot find valid image size: {0}'.format(repr(photo)))
  96             continue
  97 
  98         # For a bigger thumbnail, keep only the url_z, not the url_n
  99         if 'n' in photo['sizes']:
  100             thumbnail_src = photo['sizes']['n']['url']
  101         elif 'z' in photo['sizes']:
  102             thumbnail_src = photo['sizes']['z']['url']
  103         else:
  104             thumbnail_src = img_src
  105 
  106         if 'ownerNsid' not in photo:
  107             # should not happen, disowned photo? Show it anyway
  108             url = img_src
  109         else:
  110             url = build_flickr_url(photo['ownerNsid'], photo['id'])
  111 
  112         result = {
  113             'url': url,
  114             'img_src': img_src,
  115             'thumbnail_src': thumbnail_src,
  116             'source': source,
  117             'img_format': img_format,
  118             'template': 'images.html'
  119         }
  120         try:
  121             result['author'] = author.encode('utf-8')
  122             result['title'] = title.encode('utf-8')
  123             result['content'] = content.encode('utf-8')
  124         except:
  125             result['author'] = ''
  126             result['title'] = ''
  127             result['content'] = ''
  128         results.append(result)
  129 
  130     return results
  131
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/searx/engines/flickr_noapi.py b/searx/engines/flickr_noapi.py
  --- a/searx/engines/flickr_noapi.py
  +++ b/searx/engines/flickr_noapi.py
  @@ -118,9 +118,9 @@
               'template': 'images.html'
           }
           try:
  -            result['author'] = author.encode('utf-8')
  -            result['title'] = title.encode('utf-8')
  -            result['content'] = content.encode('utf-8')
  +            result['author'] = author
  +            result['title'] = title
  +            result['content'] = content
           except:
               result['author'] = ''
               result['title'] = ''
  
verification_info: {"golden_diff": "diff --git a/searx/engines/flickr_noapi.py b/searx/engines/flickr_noapi.py\n--- a/searx/engines/flickr_noapi.py\n+++ b/searx/engines/flickr_noapi.py\n@@ -118,9 +118,9 @@\n             'template': 'images.html'\n         }\n         try:\n-            result['author'] = author.encode('utf-8')\n-            result['title'] = title.encode('utf-8')\n-            result['content'] = content.encode('utf-8')\n+            result['author'] = author\n+            result['title'] = title\n+            result['content'] = content\n         except:\n             result['author'] = ''\n             result['title'] = ''\n", "issue": "[flickr_noapi] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)\nSimilar to #419\r\n\r\nInstallation: current master commit\r\nHow to reproduce? Search for \"kek\" on https://search.snopyta.org/ and click on \"Images\"\r\n\r\n```\r\nERROR:flask.app:Exception on / [POST]\r\nTraceback (most recent call last):\r\n  File \"/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py\", line 2292, in wsgi_app\r\n    response = self.full_dispatch_request()\r\n  File \"/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py\", line 1815, in full_dispatch_request\r\n    rv = self.handle_user_exception(e)\r\n  File \"/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py\", line 1718, in handle_user_exception\r\n    reraise(exc_type, exc_value, tb)\r\n  File \"/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py\", line 1813, in full_dispatch_request\r\n    rv = self.dispatch_request()\r\n  File \"/usr/local/searx/searx-ve/local/lib/python2.7/site-packages/flask/app.py\", line 1799, in dispatch_request\r\n    return self.view_functions[rule.endpoint](**req.view_args)\r\n  File \"/usr/local/searx/searx/webapp.py\", line 544, in index\r\n    result['title'] = highlight_content(escape(result['title'] or u''), search_query.query)\r\n  File \"/usr/local/searx/searx/utils.py\", line 79, in highlight_content\r\n    if content.lower().find(query.lower()) > -1:\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"\n  Flickr (Images)\n\n @website     https://www.flickr.com\n @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html)\n\n @using-api   no\n @results     HTML\n @stable      no\n @parse       url, title, thumbnail, img_src\n\"\"\"\n\nfrom json import loads\nfrom time import time\nimport re\nfrom searx.engines import logger\nfrom searx.url_utils import urlencode\nfrom searx.utils import ecma_unescape, html_to_text\n\nlogger = logger.getChild('flickr-noapi')\n\ncategories = ['images']\n\nurl = 'https://www.flickr.com/'\nsearch_url = url + 'search?{query}&page={page}'\ntime_range_url = '&min_upload_date={start}&max_upload_date={end}'\nphoto_url = 'https://www.flickr.com/photos/{userid}/{photoid}'\nmodelexport_re = re.compile(r\"^\\s*modelExport:\\s*({.*}),$\", re.M)\nimage_sizes = ('o', 'k', 'h', 'b', 'c', 'z', 'n', 'm', 't', 'q', 's')\n\npaging = True\ntime_range_support = True\ntime_range_dict = {'day': 60 * 60 * 24,\n                   'week': 60 * 60 * 24 * 7,\n                   'month': 60 * 60 * 24 * 7 * 4,\n                   'year': 60 * 60 * 24 * 7 * 52}\n\n\ndef build_flickr_url(user_id, photo_id):\n    return photo_url.format(userid=user_id, photoid=photo_id)\n\n\ndef _get_time_range_url(time_range):\n    if time_range in time_range_dict:\n        return time_range_url.format(start=time(), end=str(int(time()) - time_range_dict[time_range]))\n    return ''\n\n\ndef request(query, params):\n    params['url'] = (search_url.format(query=urlencode({'text': query}), page=params['pageno'])\n                     + _get_time_range_url(params['time_range']))\n    return params\n\n\ndef response(resp):\n    results = []\n\n    matches = modelexport_re.search(resp.text)\n\n    if matches is None:\n        return results\n\n    match = matches.group(1)\n    model_export = loads(match)\n\n    if 'legend' not in model_export:\n        return results\n\n    legend = model_export['legend']\n\n    # handle empty page\n    if not legend or not legend[0]:\n        return results\n\n    for index in legend:\n        photo = model_export['main'][index[0]][int(index[1])][index[2]][index[3]][int(index[4])]\n        author = ecma_unescape(photo.get('realname', ''))\n        source = ecma_unescape(photo.get('username', '')) + ' @ Flickr'\n        title = ecma_unescape(photo.get('title', ''))\n        content = html_to_text(ecma_unescape(photo.get('description', '')))\n        img_src = None\n        # From the biggest to the lowest format\n        for image_size in image_sizes:\n            if image_size in photo['sizes']:\n                img_src = photo['sizes'][image_size]['url']\n                img_format = 'jpg ' \\\n                    + str(photo['sizes'][image_size]['width']) \\\n                    + 'x' \\\n                    + str(photo['sizes'][image_size]['height'])\n                break\n\n        if not img_src:\n            logger.debug('cannot find valid image size: {0}'.format(repr(photo)))\n            continue\n\n        # For a bigger thumbnail, keep only the url_z, not the url_n\n        if 'n' in photo['sizes']:\n            thumbnail_src = photo['sizes']['n']['url']\n        elif 'z' in photo['sizes']:\n            thumbnail_src = photo['sizes']['z']['url']\n        else:\n            thumbnail_src = img_src\n\n        if 'ownerNsid' not in photo:\n            # should not happen, disowned photo? Show it anyway\n            url = img_src\n        else:\n            url = build_flickr_url(photo['ownerNsid'], photo['id'])\n\n        result = {\n            'url': url,\n            'img_src': img_src,\n            'thumbnail_src': thumbnail_src,\n            'source': source,\n            'img_format': img_format,\n            'template': 'images.html'\n        }\n        try:\n            result['author'] = author.encode('utf-8')\n            result['title'] = title.encode('utf-8')\n            result['content'] = content.encode('utf-8')\n        except:\n            result['author'] = ''\n            result['title'] = ''\n            result['content'] = ''\n        results.append(result)\n\n    return results\n", "path": "searx/engines/flickr_noapi.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"\n  Flickr (Images)\n\n @website     https://www.flickr.com\n @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html)\n\n @using-api   no\n @results     HTML\n @stable      no\n @parse       url, title, thumbnail, img_src\n\"\"\"\n\nfrom json import loads\nfrom time import time\nimport re\nfrom searx.engines import logger\nfrom searx.url_utils import urlencode\nfrom searx.utils import ecma_unescape, html_to_text\n\nlogger = logger.getChild('flickr-noapi')\n\ncategories = ['images']\n\nurl = 'https://www.flickr.com/'\nsearch_url = url + 'search?{query}&page={page}'\ntime_range_url = '&min_upload_date={start}&max_upload_date={end}'\nphoto_url = 'https://www.flickr.com/photos/{userid}/{photoid}'\nmodelexport_re = re.compile(r\"^\\s*modelExport:\\s*({.*}),$\", re.M)\nimage_sizes = ('o', 'k', 'h', 'b', 'c', 'z', 'n', 'm', 't', 'q', 's')\n\npaging = True\ntime_range_support = True\ntime_range_dict = {'day': 60 * 60 * 24,\n                   'week': 60 * 60 * 24 * 7,\n                   'month': 60 * 60 * 24 * 7 * 4,\n                   'year': 60 * 60 * 24 * 7 * 52}\n\n\ndef build_flickr_url(user_id, photo_id):\n    return photo_url.format(userid=user_id, photoid=photo_id)\n\n\ndef _get_time_range_url(time_range):\n    if time_range in time_range_dict:\n        return time_range_url.format(start=time(), end=str(int(time()) - time_range_dict[time_range]))\n    return ''\n\n\ndef request(query, params):\n    params['url'] = (search_url.format(query=urlencode({'text': query}), page=params['pageno'])\n                     + _get_time_range_url(params['time_range']))\n    return params\n\n\ndef response(resp):\n    results = []\n\n    matches = modelexport_re.search(resp.text)\n\n    if matches is None:\n        return results\n\n    match = matches.group(1)\n    model_export = loads(match)\n\n    if 'legend' not in model_export:\n        return results\n\n    legend = model_export['legend']\n\n    # handle empty page\n    if not legend or not legend[0]:\n        return results\n\n    for index in legend:\n        photo = model_export['main'][index[0]][int(index[1])][index[2]][index[3]][int(index[4])]\n        author = ecma_unescape(photo.get('realname', ''))\n        source = ecma_unescape(photo.get('username', '')) + ' @ Flickr'\n        title = ecma_unescape(photo.get('title', ''))\n        content = html_to_text(ecma_unescape(photo.get('description', '')))\n        img_src = None\n        # From the biggest to the lowest format\n        for image_size in image_sizes:\n            if image_size in photo['sizes']:\n                img_src = photo['sizes'][image_size]['url']\n                img_format = 'jpg ' \\\n                    + str(photo['sizes'][image_size]['width']) \\\n                    + 'x' \\\n                    + str(photo['sizes'][image_size]['height'])\n                break\n\n        if not img_src:\n            logger.debug('cannot find valid image size: {0}'.format(repr(photo)))\n            continue\n\n        # For a bigger thumbnail, keep only the url_z, not the url_n\n        if 'n' in photo['sizes']:\n            thumbnail_src = photo['sizes']['n']['url']\n        elif 'z' in photo['sizes']:\n            thumbnail_src = photo['sizes']['z']['url']\n        else:\n            thumbnail_src = img_src\n\n        if 'ownerNsid' not in photo:\n            # should not happen, disowned photo? Show it anyway\n            url = img_src\n        else:\n            url = build_flickr_url(photo['ownerNsid'], photo['id'])\n\n        result = {\n            'url': url,\n            'img_src': img_src,\n            'thumbnail_src': thumbnail_src,\n            'source': source,\n            'img_format': img_format,\n            'template': 'images.html'\n        }\n        try:\n            result['author'] = author\n            result['title'] = title\n            result['content'] = content\n        except:\n            result['author'] = ''\n            result['title'] = ''\n            result['content'] = ''\n        results.append(result)\n\n    return results\n", "path": "searx/engines/flickr_noapi.py"}]}