Bug->Doc #70799 [Opn->Ver]: strcasecmp is not locale aware

From: Date: Mon, 27 Jan 2020 11:20:19 +0000
Subject: Bug->Doc #70799 [Opn->Ver]: strcasecmp is not locale aware
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17222@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70799&edit=1

 ID:                 70799
 Updated by:         cmb@php.net
 Reported by:        yurets at gambler dot ru
-Summary:            strcasecmp works incorrect for CP1251
+Summary:            strcasecmp is not locale aware
-Status:             Open
+Status:             Verified
-Type:               Bug
+Type:               Documentation Problem
 Package:            Strings related
 Operating System:   FreeBSD 10.1
 PHP Version:        5.6.14
 Block user comment: N
 Private report:     N

 New Comment:

That behavior is to be expected, since strcasecmp() is *not*
locale aware (it only handles ASCII characters properly regarding
case-insensivity).  That needs to be documented.


Previous Comments:
------------------------------------------------------------------------
[2015-10-27 05:30:54] yurets at gambler dot ru

Description:
------------
---
From manual page: http://www.php.net/function.strcasecmp
---
It's the same CP1251 symbol used in test script, upper- and lower-cased

No problems if using strtolower or strtoupper, only strcasecmp is affected.

Test script:
---------------
<?
setlocale( LC_ALL, "ru_RU.CP1251", "rus_RUS.CP1251",
"Russian_Russia.1251" );
echo strcasecmp( "А", "а" );
?>


Expected result:
----------------
0

Actual result:
--------------
-32


------------------------------------------------------------------------



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


Thread (2 messages)

« previous php.doc.bugs (#17222) next »