End of Line Insanity
Moderator: General Moderators
End of Line Insanity
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.
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.
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: End of Line Insanity
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.
Linux can convert from windows to linux end of line, so it might be able to do it the other way around.
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: End of Line Insanity
I was right, linux can. Try this..
http://www.forum.jaoudestudios.com/view ... f=13&t=184
http://www.forum.jaoudestudios.com/view ... f=13&t=184
Re: End of Line Insanity
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.
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.
- volomike
- Forum Regular
- Posts: 633
- Joined: Wed Jan 16, 2008 9:04 am
- Location: Myrtle Beach, South Carolina, USA
Re: End of Line Insanity
Sounds like a post for the Linux forum on this site.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: End of Line Insanity
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.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.
(#10850)
Re: End of Line Insanity
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.
********
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.
- volomike
- Forum Regular
- Posts: 633
- Joined: Wed Jan 16, 2008 9:04 am
- Location: Myrtle Beach, South Carolina, USA
Re: End of Line Insanity
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.
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
Thanks I will google for a perl script or just open every file and resave in dreamweaver.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.
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
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.
Thanks.
Re: End of Line Insanity
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
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: End of Line Insanity
This is true for really old Macs, but Macs are all UNIX End of Lines now.arborint wrote: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.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 OP just needs a better editor