EOL Character Translation

If you are someone who develops on multiple platforms or works in a team that develops on multiple platforms, you may have run into the following issue. Person A creates a file in Windows and then makes the file visible to others by checking it into a Git repository. Person B modifies that file in Linux and then performs a difference of the two files. When creating the difference, it looks like every line was modified, but upon closer inspection, most lines look identical. This problem makes it really difficult to hone in on the actual differences between the two files. So what happened?

Since most difference utilities avoid showing you unprintable characters (even though these characters are included in the difference), the difference is difficult to spot, but chances are that each person editing the file used a different End-Of-Line (EOL) character when saving their file. Windows likes its EOL characters to be CR/LF (carriage return, line feed). Mac OS X and Linux prefer LF (line feed) while classic Mac uses just CR. So how do you fix this problem in TKE?

By default, TKE is setup in its preferences to automatically select the correct EOL character based on the system that you are running in. However, you can change this setting by viewing any one of your preference files via the “Edit / Preferences” menu and changing the value of the Editor/EndOfLineTranslation to be anyone of the values: auto, cr, crlf or lf. Information on the use of each value is provided in the preference file for quick reference. If you create a saved session to perform this type of work, the preference setting will always apply to the work done in the session but other sessions can use other values for other types of work.

So now if person A edits the file in Windows and saves it with the CR/LF EOL character, person B can bring up the file using a EOL character translation of “crlf”, edit and save the file. Then when the changes are diff’ed, only the actual changed lines will be displayed — exactly what you want!

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net

Advertisements
EOL Character Translation