diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 40aefd6..5bcc874 100644
a
|
b
|
class MultiPartParser(object):
|
110 | 110 | # HTTP spec says that Content-Length >= 0 is valid |
111 | 111 | # handling content-length == 0 before continuing |
112 | 112 | if self._content_length == 0: |
113 | | return QueryDict(MultiValueDict(), encoding=self._encoding), MultiValueDict() |
| 113 | return QueryDict('', encoding=self._encoding), MultiValueDict() |
114 | 114 | |
115 | 115 | # See if the handler will want to take care of the parsing. |
116 | 116 | # This allows overriding everything if somebody wants it. |
diff --git a/django/http/request.py b/django/http/request.py
index 96c7606..75fe4d3 100644
a
|
b
|
class QueryDict(MultiValueDict):
|
276 | 276 | encoding = settings.DEFAULT_CHARSET |
277 | 277 | self.encoding = encoding |
278 | 278 | if six.PY3: |
| 279 | query_string = force_text(query_string, encoding, errors='replace') |
279 | 280 | for key, value in parse_qsl(query_string or '', |
280 | 281 | keep_blank_values=True, |
281 | 282 | encoding=encoding): |
diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py
index eaf25ea..164c108 100644
a
|
b
|
from django.http import HttpRequest, HttpResponse, parse_cookie, build_request_r
|
12 | 12 | from django.test.client import FakePayload |
13 | 13 | from django.test.utils import override_settings, str_prefix |
14 | 14 | from django.utils import unittest |
15 | | from django.utils.http import cookie_date |
| 15 | from django.utils.http import cookie_date, urlencode |
16 | 16 | from django.utils.timezone import utc |
17 | 17 | |
18 | 18 | |
… |
… |
class RequestsTests(unittest.TestCase):
|
353 | 353 | self.assertRaises(Exception, lambda: request.body) |
354 | 354 | self.assertEqual(request.POST, {}) |
355 | 355 | |
| 356 | def test_non_ascii_POST(self): |
| 357 | payload = FakePayload(urlencode({'key': 'España'})) |
| 358 | request = WSGIRequest({ |
| 359 | 'REQUEST_METHOD': 'POST', |
| 360 | 'CONTENT_LENGTH': len(payload), |
| 361 | 'CONTENT_TYPE': 'application/x-www-form-urlencoded', |
| 362 | 'wsgi.input': payload, |
| 363 | }) |
| 364 | self.assertEqual(request.POST, {'key': ['España']}) |
| 365 | |
356 | 366 | def test_alternate_charset_POST(self): |
357 | 367 | """ |
358 | 368 | Test a POST with non-utf-8 payload encoding. |