This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: string.title() doesn't understand apostrophes
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, rhettinger, terry.reedy, vmole
Priority: normal Keywords:

Created on 2003-07-06 00:17 by vmole, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (5)
msg16890 - (view) Author: Steve Greenland (vmole) Date: 2003-07-06 00:17
Consider the following:

steveg@speedy:~/jbox$ python 
Python 2.2.3 (#1, Jun  4 2003, 02:54:59) 
[GCC 3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> "I've fallen and i can't get up".title()
"I'Ve Fallen And I Can'T Get Up"
>>> 

That looks fairly non-standard to me. Apparently, the
title()
method treats apostrophes as whitespace/word
seperators/something.

Thanks,
Steve
msg16891 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-06 09:32
Logged In: YES 
user_id=21627

Unfortunately, this usage of the apostrophe is specific to
the English language. Martin says, 'if the apostrophe is
used for indirect speech, upper-casing after it is correct'.
msg16892 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2003-07-06 15:53
Logged In: YES 
user_id=593130

If the ' directly follows a letter, then it is being used for a 
contraction and not for indirect speech, and the following 
letter should not be uppercased.
msg16893 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-07-08 06:15
Logged In: YES 
user_id=80475

The determination of what actually constitutes a word is 
language-dependent.  For instance, in French, l'arbre is 
considered two words.  See:  
http://www.unicode.org/reports/tr21/tr21-5d3.html

Also, I tried the VB and MS-Excel implementations (they call 
it "proper" instead of "title") and they match the current 
Python behavior.  I found no equivalent string method in 
Java.

msg16894 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-08 06:59
Logged In: YES 
user_id=21627

Thanks, Raymond, for this investigation. 

Closing it as wont-fix - if you want an algorithm that
follows the English language rules, you have to implement
that yourself.
History
Date User Action Args
2022-04-10 16:09:45adminsetgithub: 38798
2003-07-06 00:17:57vmolecreate