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.