title: PHP - Display all characters in html textarea (newline, whitespace included)
body: <p>I have a text field in MySQL that contains an e-mail template.</p>
  
  <p>I build an admin interface where the admin will be able to display the content in a <code>&lt;textarea&gt;&lt;/textarea&gt;</code> and edit it.</p>
  
  <p>It works great, but I'd like to actualy see the whitespaces and the <code>\r\n</code>, something like Notepad++ "Show All Characters" button.</p>
  
  <p>Here is the email template, as it is currently shown in <code>textarea</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/mOzre.jpg" alt="html textarea">
  <br/>
  <br/>
  <br/>
  <br/>
  And this is how I'd like to see it, like Notepad++ shows it, displaying the newlines and the whitespaces:</p>
  
  <p><img src="https://i.stack.imgur.com/NEFKI.jpg" alt="notepad++ show all characters"></p>
  
  <p><br/>
  <br/>
  <br/>
  How can I do that using php? Should I just escape the <code>\r\n</code> from the database to make them to show up, or is there an other way?
  <br/>
  <br/>
  <br/></p>
  
  <h2><br/></h2>
  
  <p><strong>Update.</strong>
  I did manage to create a toggle button that displays whitespaces and newlines, even while typing.</p>
  
  <p><strong>See example demo</strong> <a href="http://jsfiddle.net/QshDd/80/" rel="nofollow noreferrer">http://jsfiddle.net/QshDd/80/</a>
  <br/>
  <br/>
  Here is where I found some of this interesting code: <a href="http://www.kristofdegrave.be/2012/03/javascript-change-entered-character-in.html" rel="nofollow noreferrer">http://www.kristofdegrave.be/2012/03/javascript-change-entered-character-in.html</a>
  <br/>
  <br/>
  <br/></p>