'The set_language view decodes the HTTP_REFERER URL.'

def test_setlang_decodes_http_referer_url(self):

    self.assertEqual(reverse('with_parameter', kwargs={'parameter': 'x'}), '/test-setlang/x/')
    lang_code = self._get_inactive_language_code()
    encoded_url = '/test-setlang/%C3%A4/'
    response = self.client.post('/i18n/setlang/', {'language': lang_code}, HTTP_REFERER=encoded_url)
    self.assertRedirects(response, encoded_url, fetch_redirect_response=False)
    self.assertEqual(self.client.session[LANGUAGE_SESSION_KEY], lang_code)
