|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-26 14:21 UTC] derick@php.net
[2004-05-26 17:04 UTC] marek at lewczuk dot com
[2004-05-26 17:07 UTC] marek at lewczuk dot com
[2004-05-26 17:40 UTC] marek at lewczuk dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 16:00:02 2025 UTC |
Description: ------------ One year ago I have send info about a bug related on sorting arrays with special, language specific characters like ???. The bug has "closed" status, so it should be working. But is not... All characters are encoded in UTF-8 and also I have made proper setLocale. I don't know if this is a problem with Windows or PHP, but I think that this bug will be also present on Linux machines. The code: SetLocale(LC_COLLATE, $GLOBALS['__OS__'] == "WINDOWS" ? "Polish_Poland.65001" : "pl_PL.UTF-8"); SetLocale(LC_CTYPE, $GLOBALS['__OS__'] == "WINDOWS" ? "Polish_Poland.65001" : "pl_PL.UTF-8"); $array = array ("?liwka", "Zook", "Alfa", "Beta", "Shit"); sort($array); print_r($array); Current result of sorting: Array ( [0] => Alfa [1] => Beta [2] => Shit [3] => Zook [4] => ?liwka ) And it should be: Array ( [0] => Alfa [1] => Beta [2] => Shit [3] => ?liwka [4] => Zook ) Reproduce code: --------------- SetLocale(LC_COLLATE, $GLOBALS['__OS__'] == "WINDOWS" ? "Polish_Poland.65001" : "pl_PL.UTF-8"); SetLocale(LC_CTYPE, $GLOBALS['__OS__'] == "WINDOWS" ? "Polish_Poland.65001" : "pl_PL.UTF-8"); $array = array ("?liwka", "Zook", "Alfa", "Beta", "Shit"); sort($array); print_r($array); Expected result: ---------------- Array ( [0] => Alfa [1] => Beta [2] => Shit [3] => ?liwka [4] => Zook ) Actual result: -------------- Array ( [0] => Alfa [1] => Beta [2] => Shit [3] => Zook [4] => ?liwka )