Why are there locale troubles under Windows?
| From: | Daniele C. | Date: | Sat, 17 Feb 2007 00:06:38 +0000 |
| Subject: | Why are there locale troubles under Windows? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-27495@lists.php.net to get a copy of this message | ||
--
I will report a snippet from http://php.net/setlocale
> Warning
>
> The locale information is maintained per process, not per thread. If
> you are running PHP on a multithreaded server api like IIS or Apache
> on Windows you may experience sudden changes of locale settings while
> a script is running although the script itself never called setlocale
> itself. This happens due to other scripts running in different threads
> of the same process at the same time changing the processwide locale
> using setlocale().
>
I spent about 2 seconds before thinking: can it really be? I mean, is
there no way to set locale info per thread? And after a brief web
search I came up with this keyword: _configthreadlocale
Read more at
http://msdn2.microsoft.com/en-us/library//26c0tb7x(VS.80).aspx
(beware, this page is very slow or their servers are anyway).
Looks like this function exists since Windows 95 and guess what it
does: it affects the behaviour of the locale functions so that _each
thread will have indipendent locale settings_.
So, I though: WHY? Why does not PHP use such function in the win32
binding?
Let's be clear, I don't think to have found a solution that (the great)
PHP developers could not find, but I would like to know why they did
not fix the bad behaviour of PHP's setlocale() function using the
_configthreadlocale() win32 function, there must be some reason I
really could not think about up to now.
I really hope somebody can point me to something to read about this
topic (I found pretty nothing up to now) or better directly explain it
to me.
Thank you
--
Daniele C.