If you are having locale-related issues, like character conversion 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.
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:
// inside a php file
setlocale( LC_ALL, 'pt_BR' );