[Haskell-cafe] runInteractiveProcess and hGetLine on Windows

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed May 7 21:57:34 EDT 2008

Windows:	end of line is \r\n
Unix:		end of line is \n
BUT, these days Windows programs have to deal with text files written  
on Unix,
and Unix programs have to deal with text files written on Windows,  
when mounting networked file systems using things like NFS and Samba.   
when working with local files, there isn't any way for a program on  
system to tell where a text file originally came from.

So programs on BOTH systems really need to deal with BOTH conventions.

We can go further:  the Internet convention for end of line is, sadly,
and somewhat accidentally, the same as the Windows convention.  It's a  
pain sometimes having to remember to stuff \r into things on UNIX so  
that it
will go the right way down the wire (according to the strict protocol)  
to a
program on the other end whose designer really wished the \r weren't  
but that's the world we live in.

According to the ASCII standard, it was fully legitimate to use  
and carriage return to get over-striking (which is why ASCII includes  
such as ^ and ` : they really are for accents, and , did double duty as
cedilla, ' as acute accent, =\b/ really was not-equals (as was /\b=),  
According the the ISO 8859 standard, that's not kosher any more.
So there are (on Windows and Unix) no known uses for isolated \r  

Accordingly, a text mode that simply throws away every \r it comes  
will not just be useful on Windows, it will be useful on Unix as well.

The old DOS Ctrl-Z convention hasn't been recommended practice on  
for years, so there's not much point bothering with that.

More information about the Haskell-Cafe mailing list