Edit report at https://bugs.php.net/bug.php?id=61023&edit=1

 ID:                 61023
 Updated by:         cataphr...@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

Reply via email to