'Test that non-ASCII query strings are properly decoded (#20530, #22996).'

def test_non_ascii_query_string(self):

    environ = RequestFactory().get(u'/').environ
    raw_query_strings = ['want=caf%C3%A9', 'want=caf\xc3\xa9', 'want=caf%E9', 'want=caf\xe9']
    got = []
    for raw_query_string in raw_query_strings:
        if six.PY3:
            environ[u'QUERY_STRING'] = str(raw_query_string, u'iso-8859-1')
        else:
            environ[u'QUERY_STRING'] = raw_query_string
        request = WSGIRequest(environ)
        got.append(request.GET[u'want'])
    if six.PY2:
        self.assertListEqual(got, [u'caf\xe9', u'caf\xe9', u'caf\ufffd', u'caf\ufffd'])
    else:
        self.assertListEqual(got, [u'caf\xe9', u'caf\xe9', u'caf\ufffd', u'caf\xe9'])
