This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push: new 17ceb435e StringUtils.stripAccents(String) doesn't handle U with bar 17ceb435e is described below commit 17ceb435edca4cc0ebb9acbaa27408222db09243 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue May 14 11:15:07 2024 -0400 StringUtils.stripAccents(String) doesn't handle U with bar --- src/changes/changes.xml | 1 + .../java/org/apache/commons/lang3/StringUtils.java | 18 ++++++++++++++++++ .../apache/commons/lang3/StringUtilsTrimStripTest.java | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c12576c2c..7fa1a899b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -132,6 +132,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">Make SystemProperties.getLineSeparator(Supplier).</action> <action type="fix" dev="ggregory" due-to="hunghhdev">StringUtils.stripAccents(String) doesn't handle "\u0111" and "\u0110" (Vietnamese) #1216.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">StringUtils.stripAccents(String) doesn't handle I with bar.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">StringUtils.stripAccents(String) doesn't handle U with bar.</action> <!-- UPDATE --> <action type="update" dev="sebb" due-to="Dependabot">Bump commons-parent from 64 to 69 #1194.</action> <action type="update" dev="ggregory" due-to="Dependabot">Bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 #1175.</action> diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 03215e981..6fd3dc839 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -1420,6 +1420,7 @@ public class StringUtils { case '\u0111': decomposed.setCharAt(i, 'd'); break; + // I with bar case '\u0197': decomposed.setCharAt(i, 'I'); break; @@ -1435,6 +1436,23 @@ public class StringUtils { case '\u1DA7': decomposed.setCharAt(i, 'I'); break; + // U with bar + case '\u0244': + // LATIN CAPITAL LETTER U BAR + decomposed.setCharAt(i, 'U'); + break; + case '\u0289': + // LATIN SMALL LETTER U BAR + decomposed.setCharAt(i, 'u'); + break; + case '\u1D7E': + // LATIN SMALL CAPITAL LETTER U WITH STROKE + decomposed.setCharAt(i, 'U'); + break; + case '\u1DB6': + // MODIFIER LETTER SMALL U BAR + decomposed.setCharAt(i, 'u'); + break; default: break; } diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java index eedb5f71b..f38f08f3d 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java @@ -110,6 +110,11 @@ public class StringUtilsTrimStripTest extends AbstractLangTest { assertEquals("I i I i I", StringUtils.stripAccents("\u0197 \u0268 \u1D7B \u1DA4 \u1DA7")); } + @Test + public void testStripAccentsUWithBar() { + assertEquals("U u U u", StringUtils.stripAccents("\u0244 \u0289 \u1D7E \u1DB6")); + } + @Test public void testStripAll() { // test stripAll method, merely an array version of the above strip