After I fetch data from database I want to place it on page using htmlentities
. But the problem is that when I echo it out displays weird characters in the output - squares and other weird signs. I have checked and its because I echo in Hebrew. Any suggestions how to fix this problem?
$query = "SELECT * FROM `house_data` WHERE 1 ORDER BY `timestamp` DESC";
while(($row = mysql_fetch_assoc($run_query))){
$types[] = $row;
}
foreach($types as $data){
echo htmlentities($data['city']);
}
as Maximus2012 said, the problem is in the third argument which is encoding, VERY IMPORTANT NOTICE: an encoding in the beggining of the page does not append on this kind of cases. so just add the encoding and it works like a charm:
echo htmlentities($data, ENT_QUOTES , "UTF-8");