Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: how to force HTML to display as text

by Hero Zzyzzx (Curate)
on Jan 24, 2002 at 23:59 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-16 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found