#21708 [Opn]: ucfirst() trouble again

From: Date: Fri, 17 Jan 2003 10:18:47 +0000
Subject: #21708 [Opn]: ucfirst() trouble again
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30338@lists.php.net to get a copy of this message
ID: 21708 User updated by: overseas@mtu-net.ru Reported By: overseas@mtu-net.ru Status: Open Bug Type: Strings related Operating System: Win 2000 Pro Russian + SP2 PHP Version: 4.3.0 New Comment: Code: <? setlocale(LC_ALL,"ru_RU.cp1251"); $str = "ÞËÀ"; echo ucwords(strtolower($str)); ?> Result: Þëà Previous Comments: ------------------------------------------------------------------------ [2003-01-17 03:49:30] overseas@mtu-net.ru This bug only for Win32 =) ucwords() function once again does not work properly with strings containing international characters. Thus, any character following the "þ"(ACSII code == 254) or "Þ"(ACSII code == 222) letter will always be uppercase. Code: <? setlocale(LC_CTYPE,"ru_RU.cp1251"); $str[] = "ÏÐÎÑÒÎ"; $str[] = "ÒÞÐÜÌÀ"; $str[] = "ËþÁÎÂÍÈÊ"; $str[] = "ËÞÁÎÂÍÈÊ"; $str[] = "ËÓÁÎÂÍÈÊ =)"; $str[] = "ËÞÄÈ"; $str[] = "ëþäè"; for ($i=0;$i<sizeof($str);$i++) { echo ucwords(strtolower($str[$i]))."<br>"; } ?> Result: Ïðîñòî ÒþÐüìà ËþÁîâíèê ËþÁîâíèê Ëóáîâíèê =) ËþÄè ËþÄè ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21708&edit=1

« previous php.bugs (#30338) next »