#21708 [Com]: ucfirst() trouble again
| From: | richard dot cooling at coastdigital dot co dot uk | Date: | Tue, 28 Jan 2003 10:43:29 +0000 |
| Subject: | #21708 [Com]: ucfirst() trouble again | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31449@lists.php.net to get a copy of this message | ||
ID: 21708
Comment by: richard.cooling@coastdigital.co.uk
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:
$text = '<script language="JavaScript" type="text/JavaScript">
alert ("this shouldnt be here");
</script>';
$text =strip_tags($text, $allowed_tags);
$text =ucfirst($text);
print $text;
PHP version 4.3 on win 32.
doesnt uppercase output
alert ("this shouldnt be here");
Previous Comments:
------------------------------------------------------------------------
[2003-01-17 16:00:29] moriyoshi@php.net
Hmm, you can use mb_convert_case() instead if mbstring extension is
enabled.
http://www.php.net/mb_convert_case
------------------------------------------------------------------------
[2003-01-17 15:12:22] overseas@mtu-net.ru
Thank's. I tried to do this. No effect. =(
I think it can be feature of PHP under Win32 ;-)
------------------------------------------------------------------------
[2003-01-17 04:50:28] moriyoshi@php.net
Try this:
setlocale(LC_CTYPE,"Russian.1251");
Windows locale string convension is different to *nix's.
See
http://msdn.microsoft.com/library/en-us/vccore98/html/_crt_language_and_country_strings.asp
for detail.
------------------------------------------------------------------------
[2003-01-17 04:18:46] overseas@mtu-net.ru
Code:
<?
setlocale(LC_ALL,"ru_RU.cp1251");
$str = "ÞËÀ";
echo ucwords(strtolower($str));
?>
Result:
Þëà
------------------------------------------------------------------------
[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