views:

71

answers:

1

Hey,

I'm using htmlentities() to convert characters like Ç and ® to its character codes. I'm getting the texts from the MYSQL database.

while($row = mysql_fetch_array($array, MYSQL_NUM)){
  echo "<div style='float:left; margin-right:40px;'>
 <div style='width:148px; height:141px; background-image:url(uploads/".$row[0].")'>
   <img src='images/glasscase.png' alt=''/>
 </div>
 <font style='font-size:20px'>".htmlentities($row[1], ENT_QUOTES,"UTF-8")."</font>
 <br/>
 <font style='font-size:14px'>".htmlentities($row[2], ENT_QUOTES, "UTF-8")."</font>
</div>";
}

However $row[2] is returning an empty string when using htmlentities(). Does anyone knows what's wrong?

Thanks!

+2  A: 

Why don't you scrap 'htmlentities' and just use

htmlspecialchars();
Nathan Fitzgerald