<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Line Breaks, Carriage Returns from PHP to Javascript to HTML</title>
	<atom:link href="http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/</link>
	<description>Web development, coffee, and abe froman.</description>
	<lastBuildDate>Fri, 09 Dec 2011 15:25:14 -0800</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Reita Hevia</title>
		<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/comment-page-1/#comment-1210</link>
		<dc:creator>Reita Hevia</dc:creator>
		<pubDate>Sat, 23 Apr 2011 18:27:10 +0000</pubDate>
		<guid isPermaLink="false">#comment-1210</guid>
		<description>Awesome! What a great reading!</description>
		<content:encoded><![CDATA[<p>Awesome! What a great reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: beerwin</title>
		<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/comment-page-1/#comment-730</link>
		<dc:creator>beerwin</dc:creator>
		<pubDate>Tue, 26 May 2009 10:21:46 +0000</pubDate>
		<guid isPermaLink="false">#comment-730</guid>
		<description>Hi there,

This code is fine, it works well under Windows

When it&#039;s about Linux, you have to replace the LF(line feed) character, and drop the CR(Carriage Return) one.

As i know MacOs uses carriage return as new line character, so you should do this by checking which OS PHP is running on.</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>This code is fine, it works well under Windows</p>
<p>When it&#8217;s about Linux, you have to replace the LF(line feed) character, and drop the CR(Carriage Return) one.</p>
<p>As i know MacOs uses carriage return as new line character, so you should do this by checking which OS PHP is running on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Urilla</title>
		<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/comment-page-1/#comment-617</link>
		<dc:creator>Urilla</dc:creator>
		<pubDate>Mon, 27 Oct 2008 18:03:50 +0000</pubDate>
		<guid isPermaLink="false">#comment-617</guid>
		<description>Great work.</description>
		<content:encoded><![CDATA[<p>Great work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Haan</title>
		<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/comment-page-1/#comment-501</link>
		<dc:creator>Jeroen Haan</dc:creator>
		<pubDate>Thu, 31 May 2007 14:23:40 +0000</pubDate>
		<guid isPermaLink="false">#comment-501</guid>
		<description>&lt;?
  $escaped_value = str_replace(chr(10),&#039;\n&#039;,$_POST[&#039;comments&#039;]);
  $escaped_value = str_replace(chr(13),&#039;\r&#039;,$escaped_value);
?&gt;
window.onload = function()
  {
checkForm();
}
function checkForm()
{
document.getElementById(&#039;comments&#039;).innerHTML = &#039;&lt;? print $escaped_value;
?&gt;&#039;;
}</description>
		<content:encoded><![CDATA[<p>&lt;?<br />
  $escaped_value = str_replace(chr(10),&#8217;\n&#8217;,$_POST['comments']);<br />
  $escaped_value = str_replace(chr(13),&#8217;\r&#8217;,$escaped_value);<br />
?&gt;<br />
window.onload = function()<br />
  {<br />
checkForm();<br />
}<br />
function checkForm()<br />
{<br />
document.getElementById(&#8216;comments&#8217;).innerHTML = &#8216;&lt;? print $escaped_value;<br />
?&gt;&#8217;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Haan</title>
		<link>http://www.gobdg.com/blog/2007/02/line-breaks-carriage-returns-from-php-to-javascript-to-html/comment-page-1/#comment-500</link>
		<dc:creator>Jeroen Haan</dc:creator>
		<pubDate>Thu, 31 May 2007 14:19:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-500</guid>
		<description>I couldn&#039;t get the code to work while working with the output of a form and pushing it back to the textarea with help of javascript, but this works for me:

Now in javascript do this:
function checkForm()
{
document.getElementById(&#039;escaped_value&#039;).innerHTML = &#039;&#039;;
}
window.onload = function()
{
	checkForm();
}

Note that Firefox respects the new lines and Explorer 7 displays spaces.
Maybe someone can shed some light on that?

cheers,
Jeroen ad haan.net</description>
		<content:encoded><![CDATA[<p>I couldn&#8217;t get the code to work while working with the output of a form and pushing it back to the textarea with help of javascript, but this works for me:</p>
<p>Now in javascript do this:<br />
function checkForm()<br />
{<br />
document.getElementById(&#8216;escaped_value&#8217;).innerHTML = &#8221;;<br />
}<br />
window.onload = function()<br />
{<br />
	checkForm();<br />
}</p>
<p>Note that Firefox respects the new lines and Explorer 7 displays spaces.<br />
Maybe someone can shed some light on that?</p>
<p>cheers,<br />
Jeroen ad haan.net</p>
]]></content:encoded>
	</item>
</channel>
</rss>

