We primarily develop our PHP application on a Windows environment and have stored our text source files in PC / ANSI.
However now, a developer is joining us who uses a Mac platform and we’re running into issues creating ‘patches’ on his machine. When he makes any changes and does:
svn diff > patchfile.patch
he generates a patch file that indicates that each and every line of the source code file has been modified (which isnt the case obviously).
I tried saving a test ANSI file as:
PC / UTF-8 (using UTFCast Express which I writes the BOM by default)
PC / UTF-8 (using Notepad++ "Encoding > Convert to UTF-8" - which writes the BOM)
As well as:
PC / UTF-8 (using Notepad++ "Encoding > Convert to UTF-8 without BOM")
PC / UTF-8 (using Notepad++ "Encoding > Encode in UTF-8 without BOM")
For ALL of these cases, whenever he makes a change and does an svn diff > patchfile.patch, it outputs all the lines as if all the lines have been changed!
[we tried doing “svn diff -x -p > patchfile.patch” for the last 3 as well – no difference]
Incidentally, the files generated with the last two options continue to show up as ANSI on my PC machine. Both do not seem to modify the file at all and doing an ‘fc’ (file comparison) from the DOS prompt does not reveal any difference.
What encoding should I be using for cross-platform development?
Not a character encoding issue, but a line-ending issue. Windows uses CR-LF (13/10), Macs now use (unix style) LF only (10).
Set the subversion property svn:eol-style=native on the relevant files to make it work properly.