FIX Escape the redirect URL before outputting

Signed-off-by: Stephen Shkardoon <stephen@silverstripe.com>
BUG Fix encoding of JS redirection script
Merge pull request #2987 from tractorcow/pulls/2981

FIX Escape the redirect URL before outputting (alternate implementation)