sub escapeHTML { local $_ = shift; # make the required escapes s/&/&/g; s/"/"/g; s/</g; s/>/>/g; # change tabs to 4 spaces s/\t/ /g; # make the whitespace escapes - not required within
tags
s/( {2,})/" " x length $1/eg;
# make the brower bugfix escapes;
s/\x8b//g;
s/\x9b//g;
# change newlines to
if desired - not required with
s/\n/
\n/g;
return $_;
}