|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21708 ucwords() trouble again
Submitted: 2003-01-17 03:49 UTC Modified: 2003-02-28 07:34 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: overseas at mtu-net dot ru Assigned:
Status: Closed Package: Strings related
PHP Version: 4.3.0 OS: Win 2000 Pro Russian + SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: overseas at mtu-net dot ru
New email:
PHP Version: OS:


 [2003-01-17 03:49 UTC] overseas at mtu-net dot 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.



$str[] = "??????"; 
$str[] = "??????"; 
$str[] = "????????"; 
$str[] = "????????"; 
$str[] = "???????? =)"; 
$str[] = "????"; 
$str[] = "????"; 

for ($i=0;$i<sizeof($str);$i++) { 
    echo ucwords(strtolower($str[$i]))."<br>"; 


???????? =) 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-17 04:18 UTC] overseas at mtu-net dot ru
$str = "???";
echo ucwords(strtolower($str));


 [2003-01-17 04:50 UTC]
Try this:

Windows locale string convension is different to *nix's.


for detail.

 [2003-01-17 15:12 UTC] overseas at mtu-net dot ru
Thank's. I tried to do this. No effect. =(

I think it can be feature of PHP under Win32 ;-)
 [2003-01-17 16:00 UTC]
Hmm, you can use mb_convert_case() instead if mbstring extension is enabled.

 [2003-01-28 04:43 UTC] richard dot cooling at coastdigital dot co dot uk
$text = '<script language="JavaScript" type="text/JavaScript">
alert ("this shouldnt be here");

$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");
 [2003-02-09 10:45 UTC]

Could you also try
setlocale(LC_CTYPE, "Russian_Russia.1251"?

 [2003-02-09 11:48 UTC] overseas at mtu-net dot ru
Yes. I tried to do it after reading your comment dated 17 Jan 4:50am (with link to MSDN). Output is wrong, but...
Every time starting of script containing 
setlocale (LC_CTYPE, "Russian_Russia.1251") I  have different (!!!) results... Interest, isn't it?
 [2003-02-09 11:52 UTC] overseas at mtu-net dot ru
FYI: MySQL (3.23.xx) under Win32 with 
character_set == cp1251
also have problem with LCASE, UCASE.
 [2003-02-18 12:16 UTC]
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
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

note: The fix will be available there in 8 hours.
 [2003-02-28 07:34 UTC]
Fix the summary

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 03:01:32 2024 UTC