encoding problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AndrewBliss
Forum Newbie
Posts: 7
Joined: Mon Oct 05, 2009 4:24 pm

encoding problems

Post by AndrewBliss »

Hi, I am new to this site. I am having a problem with display UTF-8 characters on my website. I have tried most of the suggestions from google searches. Such as putting the meta html tag, the php header function. Nothing seems to help. A test case is when I put the ó character in a static html page it displays normal but when I run it threw just php and not the browser it changes the character to ó. The problems come up with I save the ó character in the mysql database and the page displays question marks like it doesn't know what it is. I am not too familiar with all this character stuff. Any help would be appreciated. Thanks.
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: encoding problems

Post by jazz090 »

we need to see the code bro.
AndrewBliss
Forum Newbie
Posts: 7
Joined: Mon Oct 05, 2009 4:24 pm

Re: encoding problems

Post by AndrewBliss »

Sorry I didn't post any code. Here is the page.

<?

ini_set('default_charset', 'utf-8');
header ('Content-type: text/html; charset=utf-8');

$r = mysql_connect('*****', '*****', '*****', true);

mysql_select_db('*****', $r);

$sql = "select name from ***** where name like ' Edu%'";

$result = mysql_query($sql);

$var = 'Educación Física y su didáctica';

?>

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>

<body>


<?

while($row = mysql_fetch_array($result))
{
echo $row['name'].'<br/>';
}
?>

</body>
</html>


It outputs this: Educaci�n F�sica y su did�ctica
Post Reply