newbie question

H

hpi

Hi,

I have a cgi script generating text output I simply want to show
unformatted.

This text also contains stuff like: <hello>

I tried the <PRE> tag but the <hello> disappears, the browser thinks it's a
tag.

If I use <textarea> the <hello> says but wide lines get wrapped and I want
to use the horizontal scrollbar to see wide lines.

Which tag should I use?

tx

HPI
 
P

PeterMcC

hpi said:
Hi,

I have a cgi script generating text output I simply want to show
unformatted.

This text also contains stuff like: <hello>

I tried the <PRE> tag but the <hello> disappears, the browser thinks
it's a tag.

If I use <textarea> the <hello> says but wide lines get wrapped and I
want to use the horizontal scrollbar to see wide lines.

Which tag should I use?

Try using the named character entities:
http://www.w3.org/TR/WD-html40-970708/sgml/entities.html

&lt;hello&rt;
 
S

Steve Pugh

I have a cgi script generating text output I simply want to show
unformatted.

This text also contains stuff like: <hello>

I tried the <PRE> tag but the <hello> disappears, the browser thinks it's a
tag.

Of course. It is a tag.
If I use <textarea> the <hello> says but wide lines get wrapped and I want
to use the horizontal scrollbar to see wide lines.

Which tag should I use?

None.

Convert < to &lt; (and to be extra-safe > &gt; though that's not
strictly need in the majority of cases).

&lt;hello&gt;


Steve
 
O

Owen Jacobson

hpi said:
Hi,

I have a cgi script generating text output I simply want to show
unformatted.

So send it to the browser as Content-Type: text/plain, not text/html.

(IE may still second-guess you if there's an <html> tag near the
beginning of the output.)
 
S

Steve Pugh

Alexander Duerloo said:
use the <plaintext></plaintext> tag

That would be the <plaintext> tag that was listed as obsolete in HTML
2 and which doesn't even exist in HTML 4?

Good idea.

Steve
 
P

PeterMcC

Steve said:
&rt;? What's that? Other than a typo?

;-)

It's a typo (_8(<) Doh!

How about &lt;abd&gt; ?

Thanks, Steve. Must have got half way through and swapped to l/r as in
&*dquo; (which I use much more often) rather than l/g in &*t;
Attention span must be functioning at &lt;11 characters.
 
T

Toby A Inkster

hpi said:
I have a cgi script generating text output I simply want to show
unformatted.

This text also contains stuff like: <hello>

In Perl:

$out = $the_stuff_that_i_want_to_display;
$out =~ s#\&#&amp;#;
$out =~ s#\>#&gt;#;
$out =~ s#\<#&lt;#;
print "<pre>$out</pre>\n";

Demonstration perl script to run from the command line:

#!/usr/bin/perl
while ($out = <>) {
$out =~ s#\&#&amp;#;
$out =~ s#\>#&gt;#;
$out =~ s#\<#&lt;#;
print $out;
}
 
H

hpi

Hi,

I have a cgi script generating text output I simply want to show
unformatted.

This text also contains stuff like: <hello>

I tried the <PRE> tag but the <hello> disappears, the browser thinks
it's a tag.

If I use <textarea> the <hello> says but wide lines get wrapped and I
want to use the horizontal scrollbar to see wide lines.

Which tag should I use?

tx

HPI

thanks people for all your help.
Of course I know I should use the &lt; etc. but then I should write
some conversion program converting ALL of these things.
I wasn't up for that.

But it seems <XMP>tag <hello></XMP> works ok too.
However this one is replaced by <PRE> which doesn't leave the
tags alone.

anyway, thanks all

HPI
 
H

hpi

So send it to the browser as Content-Type: text/plain, not text/html.

(IE may still second-guess you if there's an <html> tag near the
beginning of the output.)

I think this is the only good answer for me.

I don't want to use HTML, I just want to see my plain output in a browser.
I still have to test a little with tabs and stuff but this one works for
me in IE6 and that's enough for now.

thanks Owen!

HPI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top