CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
CrLf from textfield

 



yapp
User

Feb 13, 2002, 5:40 AM

Post #1 of 4 (2339 views)
CrLf from textfield Can't Post

To test my CGI scripts, I work used windows2000 iis/5.0, IE 5 (windowsxp, iis5.1, IE6 since yesterday)

When I receive text from a <TEXTFIELD></TEXTFIELD> input field, I seams that my CGI script receives CrLf pairs used for line-breaks. I experienced that problem when I applied a split(/\n/, $message) to the message. Nowadays, I use a regexp to convert the data, and then everything works as it should be.

However, I still have some questions:
- Is this an internet standard?
- Or is this is a bug in iis/ie?
- Does this happen elsewhere aswell?

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


fashimpaur
User / Moderator

Feb 13, 2002, 6:47 AM

Post #2 of 4 (2337 views)
Re: [yapp] CrLf from textfield [In reply to] Can't Post

Boy, we keep meeting everywhere! Okay, here's the skinny. It happens everywhere. Textfield data
from any win32 platform seems to put in \r characters instead of \n characters each time a new line
is required. When looking at the input from that field type, do a s/\r/\n/g; on that parameter. Then
all the remaining times you run the data through regexes it should work as planned.

HTH,

Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


Paul
Enthusiast

Feb 13, 2002, 8:07 AM

Post #3 of 4 (2336 views)
Re: [fashimpaur] CrLf from textfield [In reply to] Can't Post

Or you could just do:

split(/[\r\n]+/, $message)


yapp
User

Feb 13, 2002, 9:20 AM

Post #4 of 4 (2333 views)
Re: [RedRum] CrLf from textfield [In reply to] Can't Post

Thanks.

As I said, I already do that... But I don't use the \r character. I use the real ascii escape code, since perl makes \n and \r looks like what's the best for the platform the script runs at.

About my original question: does any platform has such problems, which I should handle?

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives