Fixed #19508 -- Used uri_to_iri.

This is a PR for ticket #19508 for which another PR #2919 was opened by me a few days ago.
This PR implements `uri_to_iri` as per RFC and changes the `PATH_INFO` at the very time when `environ` is being set contrary to the previous one which corrected the received url from `environ`.
Nitpick: Since Django no longer [supports Python 2.6](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django) and this is a new feature in Django 1.8, you can use Python 2.7's new ``assertIsInstance`` method here: https://docs.python.org/2.7/library/unittest.html#unittest.TestCase.assertIsInstance