|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
47 - 32 = ?
Subscribe to this entry?

 [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 15 09:01:28 2024 UTC