I have tried for a while now to set the right encoding to show danish characters on my MySQL query. I haven't found exactly a similar situation.
My output shows a question mark instead of the appropriate characters. This is my connect file.
<?php
$con=mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>
And here is my display file:
<?php
include("connect.php");
mysql_select_db("paradise",$con);
$result=mysql_query("SELECT * FROM CITATER4 ORDER BY RAND() LIMIT 1",$con);
while($data = mysql_fetch_row($result))
{
echo "<aside class=\"citatout\">";
echo "<div id=\"paradiso\" class=\"text-vertical-center-q\">";
echo utf8_encode("<h1 class=\"animated fadeIn\" align=center>$data[0]</h1>");
echo utf8_encode("<h2 class=\"animated fadeIn\" align=center>$data[1]</h2>");
echo "</div>";
echo "</aside>";
}
?>
I tried to set the encoding using this code but it still didn't change. I found this in another question here on Stackoverflow.
mysql_set_charset("utf8", $con);
I encoded the strings in the displayed file with utf8_encode and it still doesn't work.
Do you have a solution?