Well, there are far more special characters that need escaping instead of just a space or ampersand. In what way would you like to do the URL escape? Can you explain further your situation?
By the way, if the URLs are generated by dynamic scripting such as PHP or Perl, parameter escaping is usually handlded by default or there is API for you to do the needed encoding, so you typically do not need to worry about escaping at all.
For Perl, if you don't mind installing CPAN modules, the easiest and most reliable way is to use the URI module (this is my favourite). It can parse, and create many kinds of properly formatted URLs. This is an example:
URI::QueryParam - Additional query methods for URIs - search.cpan.org