From:             thomas at uninet dot se
Operating system: Windows and Linux
PHP version:      5.1.4
PHP Bug Type:     *Languages/Translation
Bug description:  strnatcmp and strnatcasecmp still can't handle swedish 
characters

Description:
------------
The bug http://bugs.php.net/bug.php?id=19795 is still not fixed. When
using swedish characters and sorting them with strnatcmp and strnatcasecmp
the result appears in the wrong order.



Reproduce code:
---------------
<?php
function test1($left, $right) {
  return strnatcasecmp($left, $right);
}
function test1b($left, $right) {
  return strcasecmp($left, $right);
}
$names = array('thomas', 'susanne', 'daniel', 'emelie', 'örjan');
setlocale(LC_ALL, 'se_SV');
uasort($names, 'test1');
print_r($names);
uasort($names, 'test1b');
print_r($names);
?>

Expected result:
----------------
Array
(
    [2] => daniel
    [3] => emelie
    [1] => susanne
    [0] => thomas
    [4] => örjan
)
Array
(
    [2] => daniel
    [3] => emelie
    [1] => susanne
    [0] => thomas
    [4] => örjan
)



Actual result:
--------------
Array
(
    [4] => örjan
    [2] => daniel
    [3] => emelie
    [1] => susanne
    [0] => thomas
)
Array
(
    [2] => daniel
    [3] => emelie
    [1] => susanne
    [0] => thomas
    [4] => örjan
)

-- 
Edit bug report at http://bugs.php.net/?id=38203&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38203&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38203&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38203&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38203&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38203&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38203&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38203&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38203&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38203&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38203&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38203&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38203&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38203&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38203&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38203&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38203&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38203&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38203&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38203&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38203&r=mysqlcfg

Reply via email to