From: "Mariusz Pękala" Date: 2007-05-03T05:51:55+09:00 Subject: Re: How to save and display a newlinefeed with rails? --UPT3ojh+0CqEDtpF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2007-05-02 21:00:05 +0900 (Wed, May), anansi wrote: > arghh thanks for your help, wokrs great :) >=20 > Alex Young wrote: > >anansi wrote: > > > >> <%=3D entry.news %>
> > > >>But the problem is that I have now textformatting inside the=20 > >>entry.news field. E.g. how can I insert
after each line in=20 > >>entry.news? > > > ><%=3D entry.news.split("\n").join("
") %> > > > >or > > > ><%=3D entry.news.gsub("\n", "
") %> Just my 2 cents, but I strongly recommend: <%=3D CGI::escapeHTML(entry.news).gsub("\n", "
") %> <%=3D CGI::escapeHTML(entry.news).split("\n").join("
") %> or <%=3D h(entry.news).gsub("\n", "
") %> <%=3D h(entry.news).split("\n").join("
") %> --=20 No virus found in this outgoing message. Checked by "grep -i virus $MESSAGE" Trust me. --UPT3ojh+0CqEDtpF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGOPnxsnU0scoWZKARAnmxAKCyBns2vdDNBvUnPQa+Pp/m/SidfgCgpt/h dR4Vy9ic8YtYMn4n7A5zo4s= =wsn5 -----END PGP SIGNATURE----- --UPT3ojh+0CqEDtpF--