I'm using the javascript replace textarea method to provide input to a form using FCKeditor. The Perl script that handles this form needs to be able to look at the input line by line, but if I pass the text from FCKeditor into an array, the entire block of text is put into the first value of the array. How can I get around this?
If I save the text from FCKeditor in this one value array into a file on the server, then try and read it line by line using a separate Perl script, I get the same result. The entire text is read to be the first line of the file, though it looks normal if I download the file and open it with a text editor.
If I download the text file onto my computer, then run my Perl script on it, it works fine. I am able to read it line by line just like normal.
If I download the text file onto my computer, then delete the remote file and upload the local one to the server again, then run my Perl script on it on the server, it works fine.
ncFTP says that the two files are the same when I download the text file and then try to upload it again to overwrite it.
I thought this may be due to the newline problem between DOS and Unix for whatever reason. Both my computer and my server are running Linux. But if I blatantly create a file using notepad or something in Windows, then transfer it to Linux and run my Perl script on it, I am able to read line by line but I get an *extra* newline at the end of each line. Kind of the converse problem.
Let me know if anyone has any info on how to go about solving this, or even a complete work around for the problem. Thanks.
If I save the text from FCKeditor in this one value array into a file on the server, then try and read it line by line using a separate Perl script, I get the same result. The entire text is read to be the first line of the file, though it looks normal if I download the file and open it with a text editor.
If I download the text file onto my computer, then run my Perl script on it, it works fine. I am able to read it line by line just like normal.
If I download the text file onto my computer, then delete the remote file and upload the local one to the server again, then run my Perl script on it on the server, it works fine.
ncFTP says that the two files are the same when I download the text file and then try to upload it again to overwrite it.
I thought this may be due to the newline problem between DOS and Unix for whatever reason. Both my computer and my server are running Linux. But if I blatantly create a file using notepad or something in Windows, then transfer it to Linux and run my Perl script on it, I am able to read line by line but I get an *extra* newline at the end of each line. Kind of the converse problem.
Let me know if anyone has any info on how to go about solving this, or even a complete work around for the problem. Thanks.
Re: Reading FCKeditor form output using Perl
Perl will read your form output into a single form field... The whole thing will be in "a single line", and will need to be split at the newlines...
Re: Reading FCKeditor form output using Perl
Re: Reading FCKeditor form output using Perl
prints out everything that was input using FCKeditor, and not just the first line. So FCKeditor is apparently not putting a single "\n" in the file, though it still seems to display correctly and not as a massive single line of text... Or am I missing something blatantly obvious here?
I did find a work around for my specific problem by putting the text into a mySQL database and using php to retrieve it, instead of including it from javascript like I had been doing before. Still, I don't know why I wasn't able to read the output from FCKeditor line by line. At least my problem is solved.
Re: Reading FCKeditor form output using Perl
What kind of server is this running on? If it's running on Windows or Mac, that might make a difference. The script I use definitely thinks there's a set of newlines there - I have to use the 's' modifier on my regex code; and the file as saved contains newlines as well.
Otherwise, weird.