diff --git a/django/http/request.py b/django/http/request.py
index 96c7606..94bf51d 100644
a
|
b
|
class HttpRequest(object):
|
224 | 224 | self._mark_post_parse_error() |
225 | 225 | raise |
226 | 226 | elif self.META.get('CONTENT_TYPE', '').startswith('application/x-www-form-urlencoded'): |
227 | | self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict() |
| 227 | self._post, self._files = QueryDict(force_str(self.body), encoding=self._encoding), MultiValueDict() |
228 | 228 | else: |
229 | 229 | self._post, self._files = QueryDict('', encoding=self._encoding), MultiValueDict() |
230 | 230 | |
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. |