1. Your file contains \r\r\n (\015\015\012) sequences. It occurs when a file with 
"\r\n"s is read into Perl script some "binary way" and then written out in a text 
mode. In text mode all "\n" are changed to "\r\n" (and so "\r\n" are changed to 
"\r\r\n")
2. The file contains some HTML tags and "tag-like" parts too. The IE forces to parse 
it as HTML then for M$ applications use to think they are ever smarter then you are.   
If you want to show *this* file like is *intended* (not like it realy is) you have to 
use something like this:

if (open TXT1,"G:/Dropbox/SMatte/WebRoot/test/bs.txt") {
        $buffer = join '', (<TXT1>);
        $buffer =~ s/<([^>]+)>/&lt;$1&gt;/g;    # it converts tags to text
        $buffer =~ s/\r\n/\n/g;         # "\r\r\n" are changed back to "\r\n" if the 
file is read in text mode
        print "Content-type: text/html\n\n";
        print "<pre>$buffer</pre>"; # white spaces are preserved 
}
HTH
JB

-----Original Message-----
From: sunil matte [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 11, 2002 3:24 AM
To: [EMAIL PROTECTED]
Subject: Re: howto display text file as it is


Hi all
         Thanks for your suggestions.. I did write a
small snippet of code as suggested ....

print "Content-type: text/plain\n\n";

if (open TXT1,"G:/Dropbox/SMatte/WebRoot/test/bs.txt")
) {
@array=<TXT1>;
print @array;
close(TXT1);
} # if
else
{ print "Failed to open file\n";
}

But it still does not work.
The link to the program is http://fraank.eycarat.ukans.edu/dev/test/print1.pl
Raw file: bs1.txt
  http://fraank.eycarat.ukans.edu/dev/test/bs1.txt

Can some one suggest me how to get this working.I am
running an IIS webserver on a windows 2000 machine.
Should i change any server settings to get this
display as it is.I also want to point out to you guys
about something i noticed. the above problem is not consistent.some of the other files 
dont have this problem(though they have sgml tags in them). the browser seems to 
recognize the text files.

you can access one of the other file which works fine
at :
http://fraank.eycarat.ukans.edu/dev/test/print2.pl

Rawfile: bs2.txt
  http://fraank.eycarat.ukans.edu/dev/test/bs2.txt

waiting for your suggestions
sunil matte.

--- sunil matte <[EMAIL PROTECTED]> wrote:
> hi crane,
>         
>          Thanks for your reply. Yeah i can write a
> small snippet of code to do what u said.But i want
> people to be able to save that file.If they do so
> with
> the code then they will have all the <pre> tags.so i
> am just wondering if there is some other way to do
> it...like writing some instruction in the file that
> makes the browser to display the text as it is.
> 
> Thanks once again for your reply....
> sunil matte...
> 
> --- "Christopher J. Crane"
> <[EMAIL PROTECTED]> wrote:
> > If you get rid of the sgml tags and enclose the
> text
> > you want displayed in
> > pre tags it will work fine. You can even use html
> > around the data you are
> > displaying...
> > 
> > Example:
> > <pre>
> > . . . Put the text data here
> > </pre>
> > Then it will display fine.
> > 
> > ----- Original Message -----
> > From: "sunil matte" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 05, 2002 4:09 PM
> > Subject: howto display text file as it is
> > 
> > 
> > > Hi all,
> > >        I have some text files on my webserver
> for
> > > viewing. I provide hyperlinks to each one of
> them.
> > >
> > > For example :
> > >
> >
>
http://fraank.eycarat.ukans.edu:8080/XBRL/ComputersAndOfficeEquipment/Hewlet
> > tPackard/BS.txt
> > >
> > > When i visit that link the display gets messed
> > up.The
> > > text files contain some sgml tags. Is it because
> > of
> > > that or something else. Is there a way to
> specify
> > to
> > > the browser to display the text as it is.
> > >
> > > Waiting for ur replies....
> > > Thanks...
> > > Sunil Matte
> > >
> > >
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Tax Center - online filing with TurboTax 
> > > http://taxes.yahoo.com/ 
> > > _______________________________________________
> > > Perl-Win32-Web mailing list 
> > > [EMAIL PROTECTED]
> > > To unsubscribe:
> > http://listserv.ActiveState.com/mailman/mysubs
> > >
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax 
> http://taxes.yahoo.com/ 
> _______________________________________________
> Perl-Win32-Web mailing list [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ 
_______________________________________________
Perl-Win32-Web mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to