I don't know why but I had to put $html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8");
before @$dom->loadHTML($html);
that I have in my code.
I still don't know why it doesn't work without it when localhost and server settings are equal in every way.