Edit report at http://bugs.php.net/bug.php?id=54315&edit=1
ID: 54315
User updated by: sms at inbox dot ru
Reported by: sms at inbox dot ru
Summary: Some string functions doesn't work as expected with
cyrillic characters
-Status: Feedback
+Status: Open
Type: Bug
Package: Strings related
Operating System: Windows 7
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
In 5.3.5 these functions work as expected even without setlocale().
I tried setlocale() after this problem was found.
I use Apache 2.2.17 (downloaded @ http://www.apachelounge.com/download/)
and php as a module (php5apache2_2.dll)
Just checked CLI - functions work fine
Previous Comments:
------------------------------------------------------------------------
[2011-03-19 13:04:34] [email protected]
ru_RU would not work reliably before (or now) as it is not a recognized
locale.
See the links on the setlocale documentation page for a list of the
available
locale (and cp).
However, the only change in 5.3.6 is that the Locale related APIs are
not per
thread instead of per process. Making them thread safe and avoid many
possible
crashes.
Which web server and SAPI do you use? Can you try this code using CLI
(cmd line)
too?
------------------------------------------------------------------------
[2011-03-19 12:58:50] sms at inbox dot ru
I had to go back to 5.3.5 where these functions work as expected.
5.3.6 breaks existing and working scripts
------------------------------------------------------------------------
[2011-03-19 12:40:23] [email protected]
Please see the note about Windows and Locale strings at
http://www.php.net/setlocale
For a portable and reliable locale support, I would suggest to move to
intl,
http://www.php.net/intl
------------------------------------------------------------------------
[2011-03-19 12:16:55] sms at inbox dot ru
Description:
------------
At least two string functions fail with cyrillic characters (cp1251) as
of version 5.3.6:
strtolower() and strtoupper().
Test script:
---------------
setlocale(LC_ALL, 'ru_RU');
echo 'strtoupper: '.strtoupper('test ÑеÑÑ').'<br>strtolower:
'.strtolower('TEST ТÐСТ');
Expected result:
----------------
strtoupper: TEST ТÐСТ
strtolower: test ÑеÑÑ
Actual result:
--------------
strtoupper: TEST ÑеÑÑ
strtolower: test ТÐСТ
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54315&edit=1