Re: <plaintext> tag obsolete? I think not!

On Fri, 9 Jan 1998, Jamie Gerdes wrote:

> 
> >perl handles &lt; and &gt; just fine.
> 
> Yes, but now when you need to print out repeated lines using something like...
> 
> STDOUT = 
> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<
> $name,                                       $email
> .
> 
> Because once you substitute the < and > with &lt; and &gt; it takes up 4
> spaces (4 of your @<<< spaces) instead of just one.
> 
> So the text   "<jamie>"  would fit in the field  "@<<<<<<", but
> "&lt;jamie&gt;" would not.
> 
> That's my dilemma.

for($count=0;$count<$lastline;$count++) {
        $name=$name[$count];
        $email=$email[$count];
        print (&PadToLength($name,45),&PadToLength($email,10),"\n");
}
print "\n";

sub PadToLength {
        my ($string,$maxsize)=@_;
        my ($padding);

        $string = substr($string,0,$maxsize);
        $padding = " " x ($maxsize - length($string));
        $string=&htmlize($string) . $padding;
        $string;
}

sub htmlize {
        my($string)=@_;

        $string=~s/\&/\&amp;/osg;
        $string=~s/</\&lt;/osg;
        $string=~s/>/\&gt;/osg;
        $string=~s/"/\&quot;/osg;

        $string;
}


Write your own formatting routine instead of depending on Perl's. Or
convert *everything* to three digit numeric entities. Or use tables. Or
use printf and tweek the format string on the fly. Or....

The point is that what you are complaining about is not an HTML problem
but an implementation problem in your code. One that *is* solvable and
does not require <PLAINTEXT>.

-- 
Benjamin Franz

Received on Friday, 9 January 1998 12:33:51 UTC