0

I have an code which read from mysql and if I use special characters i get back this �, I am using UTF-8 on PHP file and on MYSQL. If I change PHP file to UTF-8 wihtout BOM it shows me but it wont show special characters from html in this PHP.

This is a problem which has to be solved and i tryed many solutions none wont work. (I'm using mysqli)

$sql1 = " SELECT * FROM news ORDER BY id DESC ";

if ($result1 = $mysqli->query($sql1)) {
while($row = mysqli_fetch_array($result1)) {
echo "<p><b> {$row['name']} </b><br />";
echo "{$row['text']} <br />";
echo "<font size='2'> {$row['date']} </font></p>";
}   }

1 Answers1

-1

if you don't want to get those � printed in your html page, you may use one of the following functions:

$string = utf8_decode($string);
echo $string;

or:

$string = utf8_encode($string);
echo $string;
Yoric
  • 1,761
  • 2
  • 13
  • 15