Forums / Cotonti / Bugs / Archive / CR/LF in source files

Windows line break format (CR/LF) still there

Orkan
#1 2008-09-06 07:33
I just checked the latest system/functions.php in the trunk and its worst than ever before.

The file type is set to UNIX but CR/LF line breaks did not get replaced by UNIX line feeds.
Trustmaster, the software you are using its not good for that job, IMO.
For example, EditPlus do this conversion automatically when you set the file type to UNIX - apparently your soft cant do that.

http://img225.imageshack.us/img225/3595/bugunixcrlf01hh3.png
http://img225.imageshack.us/img225/1342/bugunixcrlf02ma8.png
Perl - the only language that looks the same before and after RSA encryption.
Trustmaster
#2 2008-09-06 17:12
It gets messed all the way. You see, I use UNIX and LF but don't strip CR every time. Then someone else opens a file in some editor with WIN and CR/LF preferences and here they are again.

Well, I can do bulk CR strip. But it doesn't guarantee CRs are not inserted there again later by somebody.
May the Source be with you!
Orkan
#3 2008-09-06 23:58
I see, so we should stay with windows formating then? or... tell the people to not insert CR/LF line breaks?

I agree, right now its all messed up.
Perl - the only language that looks the same before and after RSA encryption.
Trustmaster
#4 2008-09-07 19:55
Coding Style
Coding Style:
Ensure that your editor is saving files in the UNIX format. This means lines are terminated with a newline, not with a CR/LF combo as they are on Win32, or whatever the Mac uses. Any decent editor should be able to do this, but it might not always be the default. Know your editor. If you want advice on Windows text editors, just ask one of the developers. Some of them do their editing on Win32.

What else can I do?
May the Source be with you!
Orkan
#5 2008-09-07 22:40
Yah, dont worry, Trustmaster
I hope that is clear enough to everyone :)
Perl - the only language that looks the same before and after RSA encryption.
Kilandor
#6 2008-09-08 15:38
Correct me if i'm wrong this only causes problems on some editors right? By corrupting the line's if they don't support it right.

Other then that there no issues? If so just fix it as you work if you find problems, other than that we can fix it for releases.

Most modern editors I think you can set the style, I know for Notepad++ I can, which i'll set it to unix.

Another question, we using UTF8, with or without BOM
Trustmaster
#7 2008-09-08 19:22
Without BOM. BOM is Windows-only thing.
May the Source be with you!
oc
#8 2008-09-08 21:26
http://www.unicode.org/faq/utf_bom.html#23

I believe, as Kilandor, this is a editor based problem.
Orkan
#9 2008-09-08 22:40
# Kilandor : Other then that there no issues? If so just fix it as you work if you find problems, other than that we can fix it for releases.

I disagree.
The SVN "compare" command will be fooled b/c it works "per line".

And what, if making some changes in file A, I would like to see file B, but then file B needs to be converted to UNIX format, so the Commit will contain two files - instead of just one which was really modified.
Perl - the only language that looks the same before and after RSA encryption.
Kilandor
#10 2008-09-09 15:34
I think most SVN tools, will compensate for this, I know mine do when using diff.

But I did some research and there is a SVN setting svn:eol-style

Which I found you can force line endings, but it can be set to native, that way when checked out, win users get it as CRLF, nix users get it as LF, it checks out based on your OS your checking out from on Commit it stores all line endings as LF

I'll see about setting this, then no one will have any problems, or have to fool with it.

Update: I've enabled this but haven't tried it. Differnet people checkout the SVN and try it out. Tell your OS and what you find. (I don't know if you can just Update and it will work, or if you have to do a new checkout.)
This post was edited by Kilandor (2008-09-09 18:57, 15 years ago)
Orkan
#11 2008-09-10 04:51
Yah, I had read about it too... but this is a "per file" property and you cannot apply it directly to the svn repository, am I wrong?

We have several "readable" file types like: php, sql, txt, js, and so on...
And what with newly added files?

I tested this either by Update and Check Out on my WinXP, and must say that I still have UNIX files in my working copy.
Perl - the only language that looks the same before and after RSA encryption.
Kilandor
#12 2008-09-10 13:46
Well I set it to *.txt, *.php, *.tpl, forgot SQL I can add it. So, it doesn't set per single file though it can be used for specific files. I have to guess, either we need to modify all the files once, so the become stored right, or its not really in place and working, i'll try to do a bit more research and checking on it.