MTG / freesound

The Freesound website
https://freesound.org
GNU Affero General Public License v3.0
317 stars 88 forks source link

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) #1274

Closed alastair closed 1 year ago

alastair commented 5 years ago

This seems to be an issue with parsing all parameters that are sent to the page. I'd be much happier if we only read the ones that we know that we need. Alternatively, we should skip any parameter which we fail to decode.

https://logserver.mtg.upf.edu/sentry/freesound-web/issues/1270/

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
(25 additional frame(s) were not displayed)
...
  File "utils/username.py", line 64, in inner
    return func(request, *args, **kwargs)
  File "sounds/views.py", line 710, in for_user
    return render(request, 'sounds/for_user.html', tvars)
  File "utils/frontend_handling.py", line 59, in render
    return django_render(request, template_name, context, content_type, status, using=name)
  File "general/templatetags/paginator.py", line 52, in show_paginator
    params = urllib.urlencode([(key, value.encode('utf-8')) for (key, value) in request.GET.items() if key.lower() != u"page"])

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
alastair commented 5 years ago

Also happens in a different place on the search results page:

https://logserver.mtg.upf.edu/sentry/freesound-web/issues/1498/

ghost commented 4 years ago

Sentry issue: FREESOUND-WEB-FG