Dealing with DOS line endings

I ran into a problem with ediff, in that it was showing two files to be entirely different even though I knew only a few lines should differ. The problem was that the colleague who sent the second file was using Windows, and so every line in file B ended with a DOS style carriage return (or newline characters) instead of a unix style one as in file A. These carriage return characters are usually invisible, but you can see them if you evaluate the following piece of elisp

(setq inhibit-eol-conversion t)

and then reopen the file. DOS carriage returns appear at the end of each line as ^M. (An alternative would be to use cat -t on the file in a terminal to also show the carriage return characters.)

The DOS carriage returns are easily removed by using M-x set-buffer-file-coding-system and then entering unix and saving the file.