#38203 [Bgs]: strnatcmp and strnatcasecmp still can't handle swedish characters
| From: | thomas at uninet dot se | Date: | Tue, 25 Jul 2006 07:49:54 +0000 |
| Subject: | #38203 [Bgs]: strnatcmp and strnatcasecmp still can't handle swedish characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99848@lists.php.net to get a copy of this message | ||
ID: 38203
User updated by: thomas at uninet dot se
Reported By: thomas at uninet dot se
Status: Bogus
Bug Type: Strings related
Operating System: Windows and Linux
PHP Version: 5.1.4
New Comment:
setlocale(LC_ALL, 'se_SV') returns bool(false).
Even if the setlocale doesn't work it still gives a correct response
with strcmp and strcasecmp which (I think) indicates that the *nat*
functions uses another approach than the other compare functions.
Previous Comments:
------------------------------------------------------------------------
[2006-07-25 07:41:19] derick@php.net
The locale identifier is sv_SE and not se_SV.
------------------------------------------------------------------------
[2006-07-25 07:38:43] tony2001@php.net
what do you get with var_dump(setlocale(LC_ALL, 'se_SV')); ?
------------------------------------------------------------------------
[2006-07-25 07:35:27] thomas at uninet dot se
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 this bug report at http://bugs.php.net/?id=38203&edit=1