Bug #19795 [Com]: Problems with strnatcmp and strnatcasecmp
| From: | redrat at mail dot ru | Date: | Thu, 09 Feb 2012 07:32:03 +0000 |
| Subject: | Bug #19795 [Com]: Problems with strnatcmp and strnatcasecmp | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167329@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=19795&edit=1
ID: 19795
Comment by: redrat at mail dot ru
Reported by: doc at nitramlexa dot com
Summary: Problems with strnatcmp and strnatcasecmp
Status: Closed
Type: Bug
Package: Strings related
Operating System: FreeBSD 4.6
PHP Version: 4.2.2
Block user comment: N
Private report: N
New Comment:
This bug still has place in PHP 5.3.10 for all cyrillic letters (and I think for other non-ASCII
letters too). This bug-report was filled almost 10 years ago! Could anybody do something with it?
Previous Comments:
------------------------------------------------------------------------
[2004-07-29 10:42:28] larry at kamsha dot ru
I have PHP 5.0.0 release with same bug (with cyrillic characters). I've analized sources and
found out that comparison is made on "char" values. So all extended characters (with
hi-order bit 1) treated as negative.
Changing "char" to "unsigned char" would place national characters after english
characters (greater in terms of compare), that is correct, but locale-specific collation problem
will remain. This is not important for CP1251 or CP866 cyrillic encodings, because theese already
have characters sorted by values correctly. But there will be problem for KOI8-R encoding (for which
this is not the case).
The problem can be easily solved by using "strcoll" (in place of dumb value compare), I
guess.
------------------------------------------------------------------------
[2004-07-16 04:32:57] mbp at sourcefrog dot net
This bug does seem to still be present in php5 CVS. The comparison is simply by byte values, not
taking character set or locale into account.
------------------------------------------------------------------------
[2004-06-28 14:55:26] mikael at chl dot chalmers dot se
This bug seems to have popped back again in version 4.3.7
When using setlocale(LC_ALL, 'sv_SE') the national chars åäö get sorted before other
international chars, they should appear at the bottom.
------------------------------------------------------------------------
[2003-04-16 16:11:22] moriyoshi@php.net
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2003-01-27 16:11:34] kamikaze at yifan dot net
I have the same problem, with æøå. strtoupper() does, for example, not uppercase those letters.
Also i 4.2.3
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=19795
--
Edit this bug report at https://bugs.php.net/bug.php?id=19795&edit=1