Bug #61023 [Com]: Wrong sorting in strnatcasecmp for cyrillic letters

From: Date: Thu, 09 Feb 2012 10:12:14 +0000
Subject: Bug #61023 [Com]: Wrong sorting in strnatcasecmp for cyrillic letters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167340@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61023&edit=1 ID: 61023 Comment by: redrat at mail dot ru Reported by: redrat at mail dot ru Summary: Wrong sorting in strnatcasecmp for cyrillic letters Status: Not a bug Type: Bug Package: Strings related Operating System: FreeBSD 6.x-8.x PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: Oh, I see... Well, there is some another methods around here to play with. Previous Comments: ------------------------------------------------------------------------ [2012-02-09 08:40:26] cataphract@php.net I'm afraid the strnat* functions don't support any sort of localization. Take a look at functions that are locale-dependent like strcoll or ICU collators (intl extension). ------------------------------------------------------------------------ [2012-02-09 08:01:56] redrat at mail dot ru Description: ------------ The strnatcasecmp function wrongly sorts strings in Russian, putting all uppercase letters before lowercase letters. Test script: --------------- <?php echo strnatcmp("alpha", "Beta")."\t"; echo strnatcasecmp("alpha", "Beta").PHP_EOL; echo strnatcmp("альфа", "Бета")."\t"; echo strnatcasecmp("альфа", "Бета").PHP_EOL; ?> Expected result: ---------------- 1 -1 1 -1 Actual result: -------------- 1 -1 1 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61023&edit=1

« previous php.bugs (#167340) next »