primus has asked for the wisdom of the Perl Monks concerning the following question:

hello monks!

i am using the escapeHTML($str) on a string with a   in it and the string was escaped fine on windows, but when i uploaded my website to my host, it wasnt escaping... the host is running apache under linux...

everything else works fine on the web, except it is not escaping the HTML, though locally on my 2k box with IIS it escapes fine. am i missing something here?

thanks for the help monks.

Replies are listed 'Best First'.
Re: escapeHTML
by Anonymous Monk on Jan 08, 2003 at 03:39 UTC
    Code please
      sure thing:

      this is just a sample of what i do, but i have a loop and fill a hash with text that may contain HTML, and then i push the reference of the hash to an array and then load the HTML::Template with that array, though when the loop in the .tmpl file is executed it will not display the text as escaped HTML text on the server... but it does on win32.
      my (@tmp,$template); for (0 .. 4) { my ($test,$str); $str = "test   text $_"; $test{'TRY'} = escapeHTML($str); push (@tmp,\%test); } $template->param(TMP_LOOP => \@tmp);
        You might have better luck by letting HTML::Template do the escaping for you. In your template, write
        <TMPL_LOOP NAME="TMPL_LOOP"> <TMPL_VAR NAME="TRY" ESCAPE=HTML> </TMPL_LOOP>
        and the right thing will happen.

Re: escapeHTML
by OM_Zen (Scribe) on Jan 08, 2003 at 04:02 UTC
    Hi ,

    The URI::Escape() could escape the scalar variable with the string value in the HTML web page.
      That does URI escaping, not HTML entity escaping. Please pay more attention before posting such a reply.

      Makeshifts last the longest.