Opa ...
You can do this in several ways ...
You can set it in PHP itself by placing it at the beginning of the document
<?php header("Content-type: text/html; charset=utf-8"); ?>
You can stream the data output directly from the MySQL connection:
mysql_set_charset('utf8');
PDO :
$handle = new PDO("mysql:host=localhost;dbname=nomebanco",
'usuario', 'senha',
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
If the problem is only occurring with HTML , resolve it by simply setting the page's UTF-8 or UTF-8 8859-1 ...
You can also do it the hard way with str_replace :
$string="Téstè! Hasta Mañana!";
function retiraAcentos($string){
return preg_replace(array("/(á|à|ã|â|ä)/","/(Á|À|Ã|Â|Ä)/","/(é|è|ê|'ë)/","/(É|È|Ê|Ë)/","/(í|ì|î|ï)/","/(Í|Ì|Î|Ï)/","/(ó|ò|õ|ô|ö)/","/(Ó|Ò|Õ|Ô|Ö)/","/(ú|ù|û|ü)/","/(Ú|Ù|Û|Ü)/","/(ñ)/","/(Ñ)/"),explode(" ","a A e E i I o O u U n N"),$string);
} '
echo retiraAcentos($string);
I hope I have helped in some way:)