IƱaki Baz Castillo 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? > > 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 ;) > > > Thanks in advance. > > As a newbee regarding the development in ruby I am somewhat surprised that the CRLF issue is not covered by something like a ruby "pragma". With perl I am used to write something like: use open IN => ":crlf", OUT => ":bytes"; use open IN => ":bytes", OUT => ":crlf"; use open OUT => ':utf8'; ... and so on ... this "pragma" specifies how IO is *generally* to be handled. don't we have a comparable syntax ?