Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Newlines in textarea w/ CGI.pm

by smitz (Chaplain)
on Nov 18, 2001 at 23:18 UTC ( [id://126154]=note: print w/replies, xml ) Need Help??


in reply to Re: Newlines in textarea w/ CGI.pm
in thread Newlines in textarea w/ CGI.pm

Ehhmmm... sorry, but that doesn't make work either! I tried all 5 options. Have a look at this. It takes the contents of the textarea and prints them. Youll notice that between each newline you use in the texarea, a space is printed. WTF?

Replies are listed 'Best First'.
Re: Re: Re: Newlines in textarea w/ CGI.pm
by ChemBoy (Priest) on Nov 19, 2001 at 11:08 UTC

    Err... I'm wondering about your assumptions now--when I view the source of the response page, I get the newlines back just as I submitted them. You are aware that HTML formats text with all whitespace treated equally, aren't you? That is, all runs of whitespace of any kind (\s+) are condensed to a single space (just as you describe, in fact). If you want to preserve the newlines, use <PRE>preformatted text</PRE> (in CGI.pm, that's pre($text)).

    If you are in fact aware of this, I apologize, but in that case I think you're looking at a browser issue--I'm getting back exactly the results I'd expect from your code, using IE5/Mac.



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders

Re: Re: Re: Newlines in textarea w/ CGI.pm
by belg4mit (Prior) on Nov 18, 2001 at 23:20 UTC
    Try this, since you are using (based on jcwren's link, an IE3 specific syntax with <input type="textarea">

    <textarea wrap=physical></texarea>

    --
    perl -p -e "s/(?:\w);([st])/'\$1/mg"

      The HTML actually sends all the textboxes' newlines nicely, no matter what kind of wrap you are using.
      The problem is CGI.pm turns the %0A%0D into a single space, no matter how many newlines it encounters in a row. That my problem!

      SM|TZ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://126154]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found