Solution:
Do PHP string functions work the same in ASCII range independent from locale?
No, I’m afraid not. The primary counterexample is the dreaded Turkish dotted-I:
setlocale(LC_CTYPE, "tr_TR");
echo strtoupper('hi!');
-> 'H\xDD!' ('Hİ!' in ISO-8859-9)
In the worst case you may have to provide your own locale-independent string handling. Calling setlocale
to revert to C
or some other locale is kind-of a fix, but the POSIX process-level locale model is a really bad fit for modern client/server apps.