[Sbcl-help] CR/LF in files originating from Unix in Win32 SBCL

I'm trying out SBCL Win32 on a reasonably large body of code that has been
primarily developed using Allegro (Linux and Windows) with adaptations to work
on SBCL Linux done recently. A problem I'm hitting is that SBCL Win32 does
what for our purposes is the wrong thing when reading files originating from
Linux systems - e.g., read-line will give a string terminating in ^M.
Obviously the files can be converted, but that wouldn't be sufficiently robust
for our user base (the system is a natural language grammar development
environment - http://www.delph-in.net/lkb/ - with a reasonable number of users), so
I'm looking for advice on the best way of handling this within SBCL. The
issue can arise both with Lisp files - e.g., format strings with a tilde at
the end of a line cause an error - and to user-created data files. (The
Windows version of Allegro does the `right' thing.)
Ann

Thread view

I'm trying out SBCL Win32 on a reasonably large body of code that has been
primarily developed using Allegro (Linux and Windows) with adaptations to work
on SBCL Linux done recently. A problem I'm hitting is that SBCL Win32 does
what for our purposes is the wrong thing when reading files originating from
Linux systems - e.g., read-line will give a string terminating in ^M.
Obviously the files can be converted, but that wouldn't be sufficiently robust
for our user base (the system is a natural language grammar development
environment - http://www.delph-in.net/lkb/ - with a reasonable number of users), so
I'm looking for advice on the best way of handling this within SBCL. The
issue can arise both with Lisp files - e.g., format strings with a tilde at
the end of a line cause an error - and to user-created data files. (The
Windows version of Allegro does the `right' thing.)
Ann

Ann Copestake <Ann.Copestake@...> writes:
> so I'm looking for advice on the best way of handling this within
> SBCL.
The best way, from my perspective, is that you or someone else
implement an external format to deal with windows line-ending
conventions, and sends a patch to be integrated in the SBCL
distribution for everyone else to use.
That said, there are existing workarounds out there: for instance, I
believe that Edi Weitz' flexistreams library provides windows
line-handling external-formats.
Cheers,
Christophe