No longer use ISO charset, use UTF-8!
ISO Latin was retired years ago, W3C has been suggesting use of UTF8 (see RFC-3629 ) in all recommendations. Similarly, for Brazilian websites, e-PING recommendation is the UTF-8 charset standard ...
Pattern in fact : idem, UTF-8. If you check large Brazilian portals or even protugueses, you will soon see in the HTML header that the adopted standard is UTF8 (ex. <meta http-equiv="Content-Type"../>
source code of UOL ).
Your setlocale( LC_ALL, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8'...)
statement can be by prioritizing ISO and ignoring UTF8 - see what the , "if locale is an array or contains additional parameters, then each element of the array is tried as a location until it succeeds" .
I only suggest UTF-8.
A possible setlocale
, already voted, is the hint of link , but beware of confusion-Windows,
header('Content-type: text/html; charset=utf-8');
setlocale(LC_ALL, NULL); // limpa com defaults do sistema... não precisa.
// ERRADO, força Windows setlocale(LC_ALL, 'Portuguese_Brazil.1252');
setlocale(LC_ALL, 'pt_BR.utf-8'); // acho mais correto.
Adapting to your preferences would be something like
header('Content-type: text/html; charset=utf-8');
setlocale( LC_ALL, 'pt_BR.utf-8', 'pt_BR', 'Portuguese_Brazil');
date_default_timezone_set('Europe/Lisbon');
I personally always use the following configuration:
setlocale(LC_ALL,'pt_BR.UTF8');
mb_internal_encoding('UTF8');
mb_regex_encoding('UTF8');
Your PHP scripts ... Are UTF8?
Another common problem is your own PHP script, which must also be in UTF8 (!). Check out some serious and reliable publisher (never Windows Notepad!) Such as SublimeText or Textpad .
Ditto databases, XML files, etc. It needs to be all in the same charset , and, easy: just always configure everything with the "universal standard", which is UTF8.