From: Mateusz Tybura Date: 2008-03-26T02:05:10+09:00 Subject: Re: Is possible Ruby to use CRLF instead of LF? ------=_Part_7446_12677442.1206464719554 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline To change \n to \r\n you can use: a.insert(index("\n"),"\r") It will put \r before \n but only once. If there is more than one \n in tex= t you may use it in loop. 2008/3/25, I=F1aki Baz Castillo : > > Hi, AFAIK Ruby uses LF =3D \n to detect newline. But now I'm coding a > parser for a protocol that uses CRLF =3D \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 =3D<-- 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. > > > > -- > I=F1aki Baz Castillo > > ------=_Part_7446_12677442.1206464719554--