问题
Production server (This is the correct behaviour)
>>> $str = "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý";
=> "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý"
>>> strtoupper($str);
=> "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý"
>>> mb_strtoupper($str);
=> "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ"
New local environment
>>> $str = "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý";
=> "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý</string>"
>>> strtoupper($str);
=> "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ</string>"
>>> mb_strtoupper($str);
=> "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ</string>"
I can't find anything on the internet regarding this </string>
at the end of the variable.
It also fails with iconv
function
Production server
>>> iconv('UTF-8', 'ASCII//TRANSLIT', 'áè');
=> "ae"
New local environment
>>> iconv('UTF-8', 'ASCII//TRANSLIT', 'áè');
=> "'a`e"
I followed the instructions regarding PHP
found in this answer but no luck, I ignored MySQL
since I'm not using it, I also ignored the Apache one since I have Nginx.
I started to think it's because mbstring extension but can't find anything related with that.
EDIT: It's not a duplicate of this because it's not an issue with MySQL and I already tried the solutions exposed there. It's not a matter of get an alternative for iconv
but to fix the environment to do the same as Production.
来源:https://stackoverflow.com/questions/46730617/wrong-encoding-with-php