Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: html

by plaid (Chaplain)
on May 23, 2000 at 08:45 UTC ( #14341=note: print w/replies, xml ) Need Help??

in reply to printing html entities

There are two basic ways around this. The first is to use the html special characters for this, &lt and &gt, for < and > respectively. The other solution is to enclose the entire block in a <xmp> block, the contents of which are displayed as-is.

Updated: Brain fart. I meant xmp instead of pre. Really. I did. :)

Replies are listed 'Best First'.
RE: Re: html
by perlmonkey (Hermit) on May 23, 2000 at 09:22 UTC
    The second part is not correct. <PRE></PRE> will still interpret the <iostream.h>

    Use a <XMP> block or since this is permonks:
    $code =~ s/>/&gt;/g; $code =~ s/</&lt;/g;
      Or, just use HTML::Entities from the LWP library. You do have that installed, don't you?
RE: Re: html
by swiftone (Curate) on May 23, 2000 at 19:16 UTC
    Make sure you use the semicolon after the &gt; and &lt; tags. Some older browsers will not parse them without them.
      Or some new ones =) The spec for those codes says that the ";" is needed unless the ampersand and codestring are followed by whitespace or other character illegal in a codestring. That means that <html> always works, <html> is wrong since <h may someday mean something and then which do you choose? IE tries to find a working match down the string which is nice but breaks in the future and shows the wrong tag. It has also taught a half million people to do it wrong and then yell at the NS and Opera people.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-05-22 12:11 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (80 votes). Check out past polls.