Urlencode the links output by the code

If we don't urlencode the links output, then the malformed urls generated can trip up web firewalls.

there are probably other places in the code where this is an issue, but I don't want to touch them unless you think this is the right approach.  If so, just let me know and I can add the other ones.