Page 1 of 1
End of Line Insanity
Posted: Tue Dec 30, 2008 11:21 am
by icarrion
I may be going insane here.
I download the Zend Framework directly from the Zends site on to 2 different servers.
On the linux server I unzip the files and VI to them and no end of line characters.
On the Windows server I unzip and the files contain the end of line character and no carraige return.
To eliminate the characters I tried to FTP From Linux USING ASCII mode to Windows but the end of line characters reappear.
What on earth am I doing wrong?
The problem is that php does not run on windows when linux end of line chars are present.
Any help would be much appreciated.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 11:43 am
by jaoudestudios
Notepad++ can convert the end of line character.
Linux can convert from windows to linux end of line, so it might be able to do it the other way around.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 11:45 am
by jaoudestudios
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 2:04 pm
by icarrion
Sorry it's not the windows ^M end of line. It is the square symbol at the end of each line.
I've tried ftp'ing over to linux and back with no solution.
The only thing that has worked is to open up each file in Dreamweaver and resave it on Windows. But Zend Framework has alot of files and that will take a long time. Was hopeing for something faster.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 2:29 pm
by volomike
Sounds like a post for the Linux forum on this site.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 2:33 pm
by Christopher
icarrion wrote:On the linux server I unzip the files and VI to them and no end of line characters.
On the Windows server I unzip and the files contain the end of line character and no carraige return.
Sounds like the files have CRs but no LFs. I think that is how the Mac does it. Mac is CRs. Unix is LFs. Microsoft is CR+LF.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 3:07 pm
by icarrion
To be more specific here is a direct quote from the Zend website.
********
Line termination follows the Unix text file convention. Lines must end with a single linefeed (LF) character. Linefeed characters are represented as ordinal 10, or hexadecimal 0x0A.
********
So there is a UNIX LF that shows up in Windows as a square symbol.
Not sure how to convert this over so that the files parse correctly in Windows.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 3:14 pm
by volomike
On Windows, what I see people doing mostly is throwing down a Perl script to knock this out. However, you can do it just as well with command-line PHP on Windows. You have it tell you the names and paths of files in a directory and subdirectories, read them in, convert with str_replace on LF to CRLF, save the file back again, and then giving you some kind of error log so you can fix things manually.
On Windows XP, I think it comes with WordPad. On Windows Vista, I think, but may be mistaken -- I think you have to copy over WordPad from XP to it. Anyway, WordPad, when you open a file created on Linux -- it converts it over to CRLF. You can then save the file. So, whatever you don't fix with a Perl or PHP script, you can fix with WordPad, onsey-twosey.
Too bad you can't just host your PHP and Zend on Linux.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 3:24 pm
by icarrion
volomike wrote:On Windows, what I see people doing mostly is throwing down a Perl script to knock this out. However, you can do it just as well with command-line PHP on Windows. You have it tell you the names and paths of files in a directory and subdirectories, read them in, convert with str_replace on LF to CRLF, save the file back again, and then giving you some kind of error log so you can fix things manually.
On Windows XP, I think it comes with WordPad. On Windows Vista, I think, but may be mistaken -- I think you have to copy over WordPad from XP to it. Anyway, WordPad, when you open a file created on Linux -- it converts it over to CRLF. You can then save the file. So, whatever you don't fix with a Perl or PHP script, you can fix with WordPad, onsey-twosey.
Too bad you can't just host your PHP and Zend on Linux.
Thanks I will google for a perl script or just open every file and resave in dreamweaver.
My code needs to be deployed on all servers including Windows. I also use Windows as my personal development machine as well.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 4:01 pm
by icarrion
So that someone does not tear their hair out on this, although it is ugly with the linux LF and no Windows CF's, the files still run correctly. Not sure why I thought they wouldn't parse via the PHP processor.
Thanks.
Re: End of Line Insanity
Posted: Tue Dec 30, 2008 5:43 pm
by josh
It runs fine for me... If I open the file in notepad I loose line endings but my IDE and windows Apache both handle it fine, also PHP should be handling it fine. My guess is some program actually corrupted the file and wrote it back to disk. Id start over
Re: End of Line Insanity
Posted: Fri Jan 02, 2009 11:00 pm
by Chris Corbyn
arborint wrote:icarrion wrote:On the linux server I unzip the files and VI to them and no end of line characters.
On the Windows server I unzip and the files contain the end of line character and no carraige return.
Sounds like the files have CRs but no LFs. I think that is how the Mac does it. Mac is CRs. Unix is LFs. Microsoft is CR+LF.
This is true for really old Macs, but Macs are all UNIX End of Lines now.
Sounds like the OP just needs a better editor
