Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75141 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7188 invoked from network); 30 Jun 2014 11:57:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jun 2014 11:57:46 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:52564] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/80-03928-9B051B35 for ; Mon, 30 Jun 2014 07:57:45 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id ED47E8C0080; Mon, 30 Jun 2014 07:57:42 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q72NOrA8ESd0; Mon, 30 Jun 2014 07:57:42 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id A2AC88C007B; Mon, 30 Jun 2014 07:57:41 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: Date: Mon, 30 Jun 2014 12:57:37 +0100 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <679D0316-74C5-4AEC-9097-5E9793937469@ajf.me> References: To: Tjerk Meesters X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] Re: ucwords() vs title case From: ajf@ajf.me (Andrea Faulds) On 30 Jun 2014, at 12:54, Tjerk Meesters = wrote: > Hi internals, >=20 > I came across this old bug: https://bugs.php.net/bug.php?id=3D34407 >=20 > The desired behaviour for that particular person: >=20 > "the (world) now" =3D> "The (World) Now" >=20 > Currently PHP adopts a very simple rule: > 1. Capitalise first character (no matter what it is) > 2. Capitalise character preceded by a space, tab, etc. >=20 > Using string.title() from Python you'd get the expected behaviour; = they use: > 1. Capitalise first letter of a word > 2. Lowercase subsequent letters of a word > 3. Non-letters delimit words >=20 > Personally I find that the latter is too much of a departure from what = we > currently have; a compromise could be to treat punctuation as a word > delimiter. Hmm. Why not make it follow what \b in a regex would do, looking for = =93word boundaries=94? -- Andrea Faulds http://ajf.me/