Bug 30841

Summary: Capitalize work erroneously.
Product: Taglibs Reporter: Alexander Litvin <alexander_litvin>
Component: String TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patchfile to fix the capitalization in <string:capitalize> to only affect the first word.

Description Alexander Litvin 2004-08-25 11:20:19 UTC
<%@ page  pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" 
language="java" %>
<%@ taglib prefix="str" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<str:capitalize>beautiful life</str:capitalize>
 
produce: Beautiful Life  instead of expected: Beautiful life

in other words <str:capitalize> behave as <str:capitalizeAllWords>

the code for capitalize and capitalizeAllWords is actually identical
Comment 1 David H. DeWolf 2004-08-25 14:11:20 UTC
This bug is due to two issues:

1) The source for both tags uses commons-lang WordUtils.capitalize(String).

2) WordUtils does not support capitalization of only the first letter of the 
first word (WordUtils.capitalize(String) and WordUtils.capitalizeFully(String) 
both affect all words within the string).

I have attached a patch.
Comment 2 David H. DeWolf 2004-08-25 14:12:26 UTC
Created attachment 12523 [details]
Patchfile to fix the capitalization in <string:capitalize> to only affect the first word.
Comment 3 David H. DeWolf 2004-08-26 23:50:21 UTC
I think this was erroneously marked as fixed, I don't see any modifications in cvs.
Comment 4 Henri Yandell 2004-08-28 18:09:48 UTC
Now fixed. I switched it from using WordUtils.capitalize to StringUtils.capitalize.

(It was using capitalise before, which became deprecated as British spelling, and a mistake was made in 
choosing how to solve the deprecation).