<%@ 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
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.
Created attachment 12523 [details] Patchfile to fix the capitalization in <string:capitalize> to only affect the first word.
I think this was erroneously marked as fixed, I don't see any modifications in cvs.
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).