El Martes, 25 de Marzo de 2008, Gerardo Santana Góíez Garrido escribi > On 3/25/08, Iñáki Baz Castillo <ibc / aliax.net> wrote: > > 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? > > Well, you could type that text in Notepad and then copy/pasting the > text to your code. Or even better, use unix2dos. Hi, finally I did it (note also that I don't use Windows ;) ): example =<-- END_STRING Version 4 Request_Type: call From: sssss END_STRING example.gsub!(/\n/,"\r\n") XD Thanks a lot. -- Iñáki Baz Castillo