title: htmlspecialchars handling hebrew words
body: <p>I want to use htmlspecialchars to english and hebrew words, but when I save a hebrew word, it save it as the code of the word (e.g. <code>&amp;#1513;&amp;#1500;&amp;#1493;&amp;#1501;</code> for "שלום"). Code:</p>
  
  <pre><code> $txt=htmlspecialchars($txt, ENT_QUOTES, 'UTF-8');
  </code></pre>
  
  <p>I tried to use htmlentities, but same result. </p>
  
  <p>I thought maybe to make htmlspecialchars  by hand, i.e. change <code>&gt;</code> to <code>'&amp;gt;'</code> and <code>""</code> to <code>&amp;#039;</code> etc . </p>
  
  <p>Does it safe to do it? </p>
  
  <p>And how can I do it?(replace special chars to their code) I didn't find explanation how to make it</p>
  
  <p>Edit- I solved it:
  need to add this code</p>
  
  <pre><code>header('Content-Type: text/html; charset=utf-8');
  </code></pre>
  
  <p>I declared the html header as utf8, but I didn't declare also the php as utf8.</p>