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. > > PD: Also it would be great if I could enter \r\n in a Linux telnet > isntead of just \n for amnual testing, but assume it's not appropiate > question in this maillist ;) You know, you can always redirect the input. Instead of typing the lines, store them in a text file, convert them with unix2dos and then feed the file to your program: yourprog < textfile -- Gerardo Santana