PHP :: Request #34407 :: ucwords and Title Case

Request #34407 ucwords and Title Case
Submitted: 2005-09-07 13:32 UTC Modified: 2014-07-12 03:25 UTC
From: peebidj at hotmail dot com Assigned: datibbaw (profile)
Status: Closed Package: Strings related
PHP Version: 4.4.0 OS: All
Private report: No CVE-ID: None

 [2005-09-07 13:32 UTC] peebidj at hotmail dot com

Description:
------------
Non alphanumeric characters are influencing the functionality of strtolower and ucwords. When a character in the example is right after a parenthesis, that character is not seen as the first in the word, and hence is not capitalized. This was reported and dismissed earlier, however, I feel that this is something that needs to be looked at, since common sense tells us that any non-alphanumeric character cannot be capitilized.

Reproduce code:
---------------
$foo = "Krung Thep (Bangkok)";
$bar = ucwords(strtolower($foo));

echo $foo;

Expected result:
----------------
Krung Thep (Bangkok)

Actual result:
--------------
Krung Thep (bangkok)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2014-07-12 03:23 UTC] datibbaw@php.net

-Package: Feature/Change Request +Package: *General Issues

 [2014-07-12 03:23 UTC] datibbaw@php.net

With the fix in place you can now do:

ucwords(strtolower($foo), ' ('));

 [2014-07-12 03:25 UTC] datibbaw@php.net

-Status: Open +Status: Closed -Package: *General Issues +Package: Strings related -Assigned To: +Assigned To: datibbaw