Bug 30841 - Capitalize work erroneously.
Summary: Capitalize work erroneously.
Alias: None
Product: Taglibs
Classification: Unclassified
Component: String Taglib (show other bugs)
Version: 1.1
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-08-25 11:20 UTC by Alexander Litvin
Modified: 2004-11-16 19:05 UTC (History)
0 users

Patchfile to fix the capitalization in <string:capitalize> to only affect the first word. (1.22 KB, patch)
2004-08-25 14:12 UTC, David H. DeWolf
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).