title: Why these 5 (6?) characters are considered "unsafe" HTML characters?
body: <p>In PHP, there is a function called <a href="http://php.net/manual/en/function.htmlspecialchars.php" rel="nofollow noreferrer">htmlspecialchars()</a> that performs the following substitutions on a string:</p>
  
  <ul>
  <li><code>&amp;</code> (ampersand) is converted to <code>&amp;amp;</code></li>
  <li><code>"</code> (double quote) is converted to <code>&amp;quot;</code></li>
  <li><code>'</code> (single quote) is converted to <code>&amp;#039;</code> (only if the flag ENT_QUOTES is set)</li>
  <li><code>&lt;</code> (less than) is converted to <code>&amp;lt;</code></li>
  <li><code>&gt;</code> (greater than) is converted to <code>&amp;gt;</code></li>
  </ul>
  
  <p>Apparently, this is done on the grounds that these 5 specific characters are the <strong>unsafe HTML characters</strong>.</p>
  
  <p>I can understand why the last two are considered unsafe: if they are simply "echoed", arbitrary/dangerous HTML could be delivered, including potential javascript with <code>&lt;script&gt;</code> and all that.</p>
  
  <p><strong>Question 1. Why are the first three characters (ampersand, double quote, single quote) also considered 'unsafe'?</strong></p>
  
  <hr>
  
  <p>Also, I stumbled upon <a href="https://github.com/mathiasbynens/he" rel="nofollow noreferrer">this library called "he" on GitHub (by Mathias Bynens)</a>, which is about encoding/decoding HTML entities. There, I found the following:</p>
  
  <blockquote>
    <p>[...] characters that are unsafe for use in HTML content (&amp;, &lt;, >, ", ', and `) will be encoded. [...]</p>
  </blockquote>
  
  <p>(<a href="https://github.com/mathiasbynens/he#allowunsafesymbols" rel="nofollow noreferrer">source</a>)</p>
  
  <p><strong>Question 2. Is there a good reason for considering the backtick another unsafe HTML character?</strong> If yes, does this mean that PHP's function mentioned above is outdated?</p>
  
  <hr>
  
  <p>Finally, all this begs the question:</p>
  
  <p><strong>Question 3. Are there any other characters that should be considered 'unsafe', alongside those 5/6 characters mentioned above?</strong></p>