-----Original Message----- From: Robert Page IV [mailto:[EMAIL PROTECTED] Sent: 09 September 2004 03:19 To: Sean Davis Cc: [EMAIL PROTECTED] Subject: Re: CGI.pm : Handling Carriage Returns from textarea()
On Sep 6, 2004, at 8:52 PM, Sean Davis wrote: > White space (including carriage returns) is ignored by HTML, > generally. Try > surrounding your text output by the <pre> tag (preformatted text). > Does > this do what you want? > Do I do this within the textarea() form? This does not seem practical if other want to use this interface. Robert Page > Sean > > > On 9/6/04 20:10, "Robert Page IV" <[EMAIL PROTECTED]> wrote: > >> I am trying to write a simple weekly entry CGI script and I am trying >> to >> capture a the string returned from a textarea, assign the value to >> either >> a variable or array and output it to a web page with print or printf >> or >> sprintf/print. >> >> When I do this, apparently carriage returns are either not captured in >> as part of the value >> returned from the textarea value, or I am not handling the value >> returned correctly to recognize >> carriage returns. >> >> Does anyone have any recommendations as to how I can solve this issue? >> >> >> Robert C. Page IV >> > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > Robert C. Page IV Hi Robert, http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3 Says under 'Form content types': Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A'). Which means you would need something like: $textarea =~ s/\r//g; @array = split "\n", $textarea; Output to a textarea element would be like: $textarea = "Line one\r\nLine two\r\nLine three"; It is what the browser sends and expects. It is nothing to do with platforms. CGI doesn't intervene either. Good luck! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
