Bug #61023 [Opn->Nab]: Wrong sorting in strnatcasecmp for cyrillic letters
| From: | cataphract@php.net | Date: | Thu, 09 Feb 2012 08:40:26 +0000 |
| Subject: | Bug #61023 [Opn->Nab]: Wrong sorting in strnatcasecmp for cyrillic letters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167332@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
Updated by: cataphract@php.net
Reported by: redrat at mail dot ru
Summary: Wrong sorting in strnatcasecmp for cyrillic letters
-Status: Open
+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:
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).
Previous Comments:
------------------------------------------------------------------------
[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