End of Line Insanity

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
icarrion
Forum Newbie
Posts: 5
Joined: Tue Dec 30, 2008 11:20 am

End of Line Insanity

Post 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.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: End of Line Insanity

Post 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.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: End of Line Insanity

Post by jaoudestudios »

icarrion
Forum Newbie
Posts: 5
Joined: Tue Dec 30, 2008 11:20 am

Re: End of Line Insanity

Post 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.
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: End of Line Insanity

Post by volomike »

Sounds like a post for the Linux forum on this site.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: End of Line Insanity

Post 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.
(#10850)
icarrion
Forum Newbie
Posts: 5
Joined: Tue Dec 30, 2008 11:20 am

Re: End of Line Insanity

Post 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.
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: End of Line Insanity

Post 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.
icarrion
Forum Newbie
Posts: 5
Joined: Tue Dec 30, 2008 11:20 am

Re: End of Line Insanity

Post 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.
icarrion
Forum Newbie
Posts: 5
Joined: Tue Dec 30, 2008 11:20 am

Re: End of Line Insanity

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: End of Line Insanity

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: End of Line Insanity

Post 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 ;)
Post Reply