Skip to content

EOL Character Translation

Trevor Williams edited this page Apr 26, 2020 · 1 revision

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 going into preferences, selecting the Editor panel and changing the value of the End-of-line character when saving option. 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!

Clone this wiki locally