--- drieux <[EMAIL PROTECTED]> wrote:
> ...
>
http://www.wetware.com/drieux/pbl/cgi/ParseParmsToPara.txt
>
>
> ciao
> drieux
Thanks to all who contributed to this thread. Here's
what I finally ended up using, incorporating several
of your suggestions (HTML tags in code):
my $eol = chr(13) . chr(10); # Test CR/LF
combination
#my $eol = chr(13); # Test CR alone
#my $eol = chr(10); # Test LF alone
my $Text = "Para.${eol}Para.${eol}Para.";
if( $Text =~ m/\x0d/ ) {
$Text =~ s/\x0a//g;
$Text =~ s/\x0d/<\/p><p>/g;
}
else {
$Text =~ s/\x0a/<\/p><p>/g;
}
$Text = "<p>$Text</p>";
print $Text;
(Again, this is just my test program. The ultimate
intent is to get the input from a TEXTAREA tag in CGI
POST data, replace the newlines with P tags, and
present it on an HTML page as well as be able
translate it back to the newlines for further editting
in a TEXTAREA.)
This wraps the paragraph begin and end tags around
each paragraph, which is the official way of doing it,
rather than just using the begin tag as I initially
was doing. I could have also just replaced newlines
with BR tags, but again that seemed like "cheating".
I coded to allow for all variations of end-of-line,
since despite the post about getting CR/LF on Linux, I
didn't think I could assume this would always be the
case. I couldn't find the issue addressed at all on
the official W3 HTML 4.01 spec
(http://www.w3.org/TR/html4/interact/forms.html#h-17.7).
In fact, that document didn't even address the WRAP
attribute, maybe that is deprecated or a non-standard
addition? On IRT.ORG
(http://tech.irt.org/articles/js216/index10.htm),
there is a discussion which implies that the character
may indeed vary between operating systems. Did they
test this before printing it? Maybe, maybe not, but
I'd rather be safe and handle the possibility.
Thanks again to everyone.
- John
=====
"When you're following an angel, does it mean you have to throw your body off a
building?" - They Might Be Giants, http://www.tmbg.com
----
Word of the week: Serendipity, see http://www.bartleby.com/61/93/S0279300.html
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]