From: "Iñaki Baz Castillo" Date: 2008-03-28T08:04:18+09:00 Subject: Re: Is possible Ruby to use CRLF instead of LF? El Martes, 25 de Marzo de 2008, Iñaki Baz Castillo escribió: > Hi, AFAIK Ruby uses LF = \n to detect newline. But now I'm coding a > parser for a protocol that uses CRLF = \r\n for newline. In fact, \n > is not considered a newline. > > Is it possible to get Ruby working with CRLF instead of LF? > > For example, I want to declare this string (for testing): > > example =<-- END_STRING > Version 4 > Request_Type: call > From: sssss > END_STRING > > and I want that string to match \r\n at the end of each line instead > of \n, is it possible? Ok, using io.gets or io.readline I can set as parameter the lines separator string: ios.gets(sep_string=$/) And in Ruby by default (at least in Linux) variable $/ is \n. But I can set this variable: $/ = "\r\n" so I assume it would work. -- Iñaki Baz Castillo