Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the proper line-ending preferences for an open-source web project? Obviously it includes source code of PHP, HTML, CSS and Javascript.

The source code is managing via Github now, and there are Windows (8 & 7), Linux (Ubuntu) and OSX developers inside the team, which means all the major operating systems.

P.S. We are using "Windows" CRLF line-ending, plus "UTF-8 without BOM" right now, without facing any problem, however I think it might be better to use "*nix/OSX" LF style. I heard some stories about the problems that caused by the additional "CR" on Linux or OS X.

share|improve this question
1  
Remember to not put ?> at the end of your PHP files. –  Michael Hampton Dec 6 '12 at 17:57
    
@MichaelHampton yeah, I've seen that mainly on Zend and Yii frameworks, could you explain me why? thanks! –  Mahdi Dec 6 '12 at 18:39
1  
PHP closing tag –  Michael Hampton Dec 6 '12 at 18:43
    
@MichaelHampton Thank you so much Michael :) –  Mahdi Dec 6 '12 at 18:51
add comment

2 Answers

up vote 2 down vote accepted

windows line ending will cause problems on Linux and some times on Mac too. I've seen some Mac files on linux which appear to have a ^M at the end of each line. So, you best choice is the Linux line ending...

share|improve this answer
    
yes, I have heard the same from others also! thanks! –  Mahdi Dec 6 '12 at 11:20
    
Notepad itself does not recognize just \n, however I do think that is the widely accepted format. In my opinion it shouldn't matter - it's easy enough to convert between different formats. –  Nathan Adams Dec 6 '12 at 16:13
add comment

On Windows, Programmer's notepad can handle *nix line endings, even if Notepad.exe can't. Also, Git can automatically convert line endings: see https://help.github.com/articles/dealing-with-line-endings

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.