Fix URL quoting

The `quote` and `unquote` functions from python's `urllib` have [unicode issues](http://bugs.python.org/issue8136). This fixes that by providing wrappers which encode the input and decode the output to these functions.

This is meant to fix a unicode/encoding issues on the post-login redirect.

This also changes `unquote_plus` to `unquote` in that case because some URLs may contain plus signs which should not be replaced.