|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-10-27 13:39 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
Description: ------------ After setting script locale to ru_RU.UTF-8, behavior of functions strtoupper and atrtolower becomes unpredictable. Function setlocale, reports that encoding is setted to desired. But case conversion make no changes or change letters incorrectly (results may vary). Reproduce code: --------------- <?php header('Content-type: text/html; charset=utf-8'); $sL = '?????????????????????????????????'; // lower russian alphabet, source file must be in utf-8 encoding $sU = '?????Ũ??????????????????????????'; // upper russian alphabet echo setlocale(LC_ALL, 'ru_RU.UTF-8') .'<br>'; echo 'Lower to upper:<br>'; echo strtoupper($sL) .'<br>'; // incorrect result echo mb_strtoupper($sL, 'utf-8') .'<br>'; // correct result, for comparsion echo 'Upper to lower:<br>'; echo strtolower($sU) .'<br>'; // incorrect result echo mb_strtolower($sU, 'utf-8') .'<br>'; // correct result, for comparsion ?> Expected result: ---------------- ru_RU.UTF-8 Lower to upper: ?????Ũ?????????????????????????? ?????Ũ?????????????????????????? Upper to lower: ????????????????????????????????? ????????????????????????????????? Actual result: -------------- ru_RU.UTF-8 Lower to upper: ?????̸?????????????????????????? ?????Ũ?????????????????????????? Upper to lower: ��������������������������������� ?????????????????????????????????