Fix unicode errors with the redirect middleware again (bug 1097147))

Fixes [bug 1097147](https://bugzilla.mozilla.org/show_bug.cgi?id=1097147) again (cf #362 which was reverted)