setlocale(LC_ALL, 'en_GB.UTF8'); return false on Windows Server 2003 R2 – Zend CE PHP 5.3.5 ?
Function in question:
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
From the PHP Manual:
The return value of
setlocale()depends on the system that PHP is running. It returns exactly what the system setlocale function returns.
So in your case it returns false because the system returns false. It is likely that the locale you’re using is not available on your system.
A list of
setlocale strings supported by Windows is available here. For British English you want
uk. Windows doesn’t support multi-byte character sets like UTF-8 though; you will probably end up with Windows-1252.
I would like to add that the problem of Windows not supporting utf-8 can be improved with something like this:
$str=strftime('%a'); //for example if(!mb_check_encoding($str,'utf-8')) $str=utf8_encode($str);
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂