See also the escapeHTML() routine provided by the CGI module.
In reply to Re: Switching out characters inside links by gmargo in thread Switching out characters inside links by Anonymous Monk