Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: how to force HTML to display as text

by Hero Zzyzzx (Curate)
on Jan 24, 2002 at 23:59 UTC ( #141301=note: print w/replies, xml ) Need Help??


in reply to how to force HTML to display as text

Or, since you're using CGI.pm already to parse your form variables (of course you are, right!?), you can just use its escapeHTML function, too:

use CGI; my $q=CGI->new(); $file_loc="$sorc"; $whattoread = fopen($file_loc, "r"); $file_contents=fread($whattoread, filesize($file_loc)); fclose($whattoread); print $q->header(); print $q->pre($q->escapeHTML($file_contents));

which allows you to display your HTML very reliably, without IE idiotically second-guessing your mime-types. Plus, you can wrap this in whatever real HTML you like.

HTH

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://141301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-01-20 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?