Don't use urlquote

We experienced some issues with certain URLs containing encoded characters being encoded again when passed through the middleware and redirected (see added tests for some examples). It is important for us that the URLs stay as they are and that only the trailing slash is affected.

The point was then raised as to why the URL was split and reconstructed at all. This PR does away with that process and uses a regular expression to locate and remove the trailing slash.

I understand the current implementation merely mirrors the Django code but it's not too clear why `urlquote` was added there in the first place either. See [commit](https://github.com/django/django/commit/5ef7c4c525c1e493c3feaf89606a5c1b36acdfc3#diff-1f8be0eae49a1bf37d52829eaeda6a4eR47) and [ticket](https://code.djangoproject.com/ticket/5762).