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. שלום
for "שלום"). Code:
$txt=htmlspecialchars($txt, ENT_QUOTES, 'UTF-8');
I tried to use htmlentities, but same result.
I thought maybe to make htmlspecialchars by hand, i.e. change >
to '>'
and ""
to '
etc .
Does it safe to do it?
And how can I do it?(replace special chars to their code) I didn't find explanation how to make it
Edit- I solved it: need to add this code
header('Content-Type: text/html; charset=utf-8');
I declared the html header as utf8, but I didn't declare also the php as utf8.