If you are having problems related locale like character convertion or encoding, it is possible that the locale that you are trying to use is not properly installed on the server.
If you are on a VPS, you can generate your locale definitions.
1) check that your locale is installed:
# locale -a
This will list all the locales. You can generate the definition with:
# localedef -c -f ISO-8859-1 -i pt_BR pt_BR
Replace the character map (ISO-8859-1) and locale (pt_BR) with your needs.
Then on PHP, set the locale:
<?php
setlocale( LC_ALL, 'pt_BR' );
?>