Linda Hardesty skrev/wrote: >Thanks very much for the tip about Perl not needing < and > to be >escaped. I thought your fix was very promising, but it didn't work >because the text from the textarea has no <p>'s and no <br>'s. It >does have an ascii 10 (Hex A) line break character where the typist >has hit return. There is no special character where the text wraps >on the screen. If you run the script under macperl, than that's the source of the problem (see note below), otherwise I'd suggest looking at what you can do with the wrap attribute to the textarea tag. >So, I replaced the <p> with the line break character that I copied >out of the saved message. Now the script puts my quote character >after line breaks, but of course it doesn't look too good because >the text still wraps, but doesn't have quote characters in front of >the wrapped lines. My question now is, do textareas work differently >on Unix? - because this script on some web sites seems to work >correctly. > >This code is part of where the message text file is created: > > print "Message:<br>\n"; > print "<textarea COLS=50 ROWS=10 name=\"body\">\n"; > $FORM{'body'} =~ s/</</g; > $FORM{'body'} =~ s/>/>/g; > $FORM{'body'} =~ s/"/"/g; > print "$FORM{'body'}\n"; > print "</textarea><p>\n"; > >It seems to expect the data receive from "submit" to have <,> and " > >Later, when a file is read into variables, is this: > > if ($FORM{'body'}) { > $body = "$FORM{'body'}"; > $body =~ s/\cM//g; this line filters out returns, if running under MacPerl, try replacing \cM with \r or \012 (linefeed) > $body =~ s/\n\n/<p>/g; under MacPerl, this line replaces two consecutive returns with a <p>, but there are no reurns left ... > $body =~ s/\n/<br>/g; as above return -> <br> > $body =~ s/</</g; > $body =~ s/>/>/g; > $body =~ s/"/"/g; > } > else { > &error(no_body); > } > > if ($quote_text == 1) { > $hidden_body = "$body"; > $hidden_body =~ s/</</g; > $hidden_body =~ s/>/>/g; > $hidden_body =~ s/"/"/g; > } > >>>This is the code I thought I had identified as containing the >>>problem, but one of my kind responders said I might need to post >>>more code. >>> >>>if ($quote_text == 1) { >>> @chunks_of_body = split(/\<\;p\>\;/,$hidden_body); >>> foreach $chunk_of_body (@chunks_of_body) { >>> @lines_of_body = split(/\<\;br\>\;/,$chunk_of_body); >>> foreach $line_of_body (@lines_of_body) { >>> print NEWFILE ": $line_of_body\n"; >>> } >>> print NEWFILE "\n"; >>> } >>>} >>> >>>The split function never seems to find any < etc., or insert any >>>colons, except at the beginning of the text. >>> >>>$hidden_body is set to $body when the posting is to contain a >>>quote. $body comes from what someone has typed into a TEXTAREA on >>>the previous posting. Here is the beginning of the program, as >>>modified by me: >> >>[snip] >>2. In what I've quoted above from your message, there is one >>glaring question: Is your intent to split on the string '<p>' >>or the string '<p>' ?? In HTML it's necessary to escape '<' & '>' >>so the browser doesn't interpret them as part of HTML markup. But >>*not so* in Perl. in Perl, your statements from above would be: >> >> @chunks_of_body = split(/<p>/,$hidden_body); >> ... >> @lines_of_body = split(/<br>/,$chunk_of_body); >> >>if you are trying to split on the P or BR HTML elements. > > >==== Want to unsubscribe from this list? >==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org Christian _____________________________________________________ http:/ /www.solvare.se/individer/christian/ ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org