etianen / aiohttp-wsgi

WSGI adapter for aiohttp.
https://aiohttp-wsgi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
232 stars 20 forks source link

[Django] bug with cyrillic chars in URL #13

Closed arxell closed 7 years ago

arxell commented 7 years ago
 File "/Users/antonogorodnikov/repo/partner/venv3/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/antonogorodnikov/repo/partner/venv3/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 121, in GET
    raw_query_string = get_bytes_from_wsgi(self.environ, 'QUERY_STRING', '')
  File "/Users/antonogorodnikov/repo/partner/venv3/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 241, in get_bytes_from_wsgi
    return value.encode(ISO_8859_1) if six.PY3 else value
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 62-64: ordinal not in range(256)

The problem is here: "QUERY_STRING": request.rel_url.query_string, https://github.com/etianen/aiohttp-wsgi/blob/master/aiohttp_wsgi/wsgi.py#L230

The solution is: "QUERY_STRING": request.rel_url.raw_query_string,

etianen commented 7 years ago

Thanks for the report! I'll sort this today.

etianen commented 7 years ago

Or, if you want credit for the fix, I'll take a pull request. :)

arxell commented 7 years ago

done https://github.com/etianen/aiohttp-wsgi/pull/14