#14655 [Asn->Csd]: ucwords failing randomly with international characters

From: Date: Wed, 25 Dec 2002 08:30:38 +0000
Subject: #14655 [Asn->Csd]: ucwords failing randomly with international characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-28353@lists.php.net to get a copy of this message
ID: 14655 Updated by: moriyoshi@php.net Reported By: xtango@netcombbs.com.ar -Status: Assigned +Status: Closed Bug Type: Strings related Operating System: Windows XP Pro (spanish) PHP Version: 4.1.0 Assigned To: hholzgra New Comment: Closing... Previous Comments: ------------------------------------------------------------------------ [2002-12-23 10:15:03] xtango@netcombbs.com.ar Somebody said that this is a problem with setlocale (Windows) and not with ucwords. This issue is beign debated in 14655 and 16718. Also, mb_convert_case() seems to be safe. I guess this bug can be closed. ------------------------------------------------------------------------ [2002-12-21 09:49:04] moriyoshi@php.net You can use mb_convert_case() instead of ucwords. Could I close this bug? ------------------------------------------------------------------------ [2002-08-27 07:50:25] fille@fukt.bth.se I had this bug to. To get around it, I added some 'hair' to the code. $string=ucwords($string); //Bugfix from here on for($i=0;$i<strlen($string);$i++) if((ctype_upper($string[$i]) &&( $string[$i-1]==" " || $i==0 ))!=TRUE) $string[$i]=strtolower($string[$i]); I'm a PHP newbie so I guess some of you can come up with a brighter solution. This code lowercases _all_ letters that is not either the first in the string or following a space. If your application does not meet both this criterias, you might not want this code. ------------------------------------------------------------------------ [2002-07-13 18:10:13] derick@php.net chancing status ------------------------------------------------------------------------ [2002-06-17 07:02:15] hholzgra@php.net setlocale() doesn't work well with multithreaded servers as the current locale is set globaly for all threads ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/14655 -- Edit this bug report at http://bugs.php.net/?id=14655&edit=1

« previous php.bugs (#28353) next »