Physically, different systems represent the new line character
in a text file differently. This can sometimes cause
difficulties when the file was written on one system, and is
being read on another. In most cases, a file written as text on
one system will not even be readable on another system. The
major exceptions are Windows and Unix (and Mac OS, too, I think,
even before it was Unix), however; on all of these systems,
files are just a sequence of bytes, and each system, by
convention, uses a simple sequence of one or two characters to
represent a line end (or line separator---the convention isn't
clear under Windows). If these are the only systems targetted
(and that's true for a lot of programs), then it's possible to
read the file, separated into lines, but you may get some extra
characters in the lines (most typically, and additional '\r\
at the end of every line when reading under Unix if the file was
written under Windows). The code you cite is just trying to
remove these characters, in an extremely overly cautious manner.