diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 968093a11..a0f83a159 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -5765,7 +5765,7 @@ public class StringUtils { } final char firstChar = str.charAt(0); - final char newChar = Character.toUpperCase(firstChar); + final char newChar = Character.toTitleCase(firstChar); if (firstChar == newChar) { // already capitalized return str; diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 49c95722c..5cc665a15 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -250,6 +250,9 @@ public class StringUtilsTest { assertEquals("capitalize(string) failed", FOO_CAP, StringUtils.capitalize(FOO_UNCAP)); + assertEquals("capitalize(String) is not using TitleCase", + "\u01C8", StringUtils.capitalize("\u01C9")); + // Javadoc examples assertNull(StringUtils.capitalize(null)); assertEquals("", StringUtils.capitalize(""));