in reply to Switching out characters inside links
gmargo pointed to the right direction in his reply:
$ perl -we 'use CGI; $url = "http://www.somedomain.com/index.cgi?page= +home&var=1&no=2&so=forth&so=on"; print qq[<a href="], CGI::escapeHTML +($url), qq[">description</a>\n];' <a href="http://www.somedomain.com/index.cgi?page=home&var=1&n +o=2&so=forth&so=on">description</a>
It's of course easier to escape the ampersands before you compose the whole text of the page in a variable, because in the latter case it's hard to find out what exactly to escape, and if there are unescaped quotes or angle brackets or ampersands that look like they start valid xml escapes, you might not even be able to parse the results out.
|
|---|