title: Internet explorer 8 cannot replace newline, while internet explorer 9, firefox and chrome can?
body: <p>On my site I have a large number of images with accompanying text, sent from the server as php <code>json_encode($object)</code> like so:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     var jsonimgs = '[["90","1","Foraeldreforeningens Chris McDonald-arrangement i aulaen ma. 10. oktober 2011 \nFotos: Silas Staal ","cmd13.jpg","15","0"],["91","2","Foraeldreforeningens Chris McDonald-arrangement i aulaen ma. 10. oktober 2011\nFotos: Silas Staal ","cmd1.jpg","15","1"],["92","3","Foraeldreforeningens Chris McDonald-arrangement i aulaen ma. 10. oktober 2011\nFotos: Silas Staal ","cmd2.jpg","15","2"]]';
     jsonimgs = jsonimgs.replace(/(\r\n)|(\n)/g, '&lt;br /&gt;');
     var images = jQuery.parseJSON(jsonimgs);
  &lt;/script&gt;
  </code></pre>
  
  <p>This images object is used in javascript space to handle navigation between images.</p>
  
  <p>As you an see i replace all newlines with a <code>&lt;br&gt;</code> tag, because otherwise an exception is thrown by the <code>.parseJSON</code> function, and the images variable is not created.</p>
  
  <p>This works fine in internet explorer 9, latest version of firefox and google chrome. But when I try to run it in internet explorer 8, it does not work. My guess is that internet explorer 8 does not for some reason replace the newline tags, and that the <code>.parseJSON</code> function therefore does not work, and that the images variable therefore is not created.</p>
  
  <p>So my question is: How can I ensure that the images variable is always created in all browsers, no matter what type of characters there might be in the <code>$images</code> variable sent from the server?</p>
  
  <p>Kind regards.</p>