Escape Meta Characters



Sister

HypertextMarkupLanguage tags are enclosed in angle brackets. We don't want any of our text to be interpreted as html tags so we substitute an html special code for every angle bracket. Likewise, if a special code appears in the text (introduced with an ampersand) then we want to escape that also. We do the ampersand substitution first so that we don't deactivate our own codes. The code below is inadequate for handling 8-bit chars. I'm not keen on fixing it yet, because it makes me wonder why Ward didnt UseCgiDotPm ? --BrianEwins

  sub EscapeMetaCharacters {
    s/&/&/g;
    s/</&lt;/g;
    s/>/&gt;/g;
  }

 

Last edited March 26, 2000
Return to WelcomeVisitors