i have the following PHP code:
<?php
ini_set( 'default_charset', 'UTF-8' );
mb_internal_encoding('UTF-8');
function labelValidate($label)
{
echo mb_detect_encoding($label.'x', 'UTF-8, ISO-8859-1');
echo '<br />';
echo mb_detect_encoding('Rio, coração do Brasil', 'UTF-8, ISO-8859-1');
}
labelValidate('Rio, coração do Brasil');
?>
I get this output:
ISO-8859-1
UTF-8
Anybody knows why the parameter $label has ISO charset, but the direct echo which i created inside the function has UTF-8 encode?
This is generating a headache to me, because i have to put a utf8_encode in $label var, otherwise i get problematic chars in the output.
Thanks for any help!
With the help of @Marc B and @Michael Madsen, i downloaded Notepad++ (PHP IDE) and converted the file UTF-8 charset without BOM, so all my problems have been resolved. The Dreamweaver was saving some files as ANSI, this was generationg the confusion on PHP.
Many thanks for all!