StringUtils.stripAccents(String) doesn't handle I with bar

This commit is contained in:
Gary Gregory 2024-05-14 11:04:45 -04:00
parent 0b00e8de26
commit 006d1d1df9
3 changed files with 21 additions and 0 deletions

View File

@ -131,6 +131,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">Make ObjectUtils.getFirstNonNull(Supplier...) null-safe.</action>
<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>
<!-- 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>

View File

@ -1420,6 +1420,21 @@ public class StringUtils {
case '\u0111':
decomposed.setCharAt(i, 'd');
break;
case '\u0197':
decomposed.setCharAt(i, 'I');
break;
case '\u0268':
decomposed.setCharAt(i, 'i');
break;
case '\u1D7B':
decomposed.setCharAt(i, 'I');
break;
case '\u1DA4':
decomposed.setCharAt(i, 'i');
break;
case '\u1DA7':
decomposed.setCharAt(i, 'I');
break;
default:
break;
}

View File

@ -105,6 +105,11 @@ public class StringUtilsTrimStripTest extends AbstractLangTest {
assertEquals(input, StringUtils.stripAccents(input), "Failed to handle Korean text");
}
@Test
public void testStripAccentsIWithBar() {
assertEquals("I i I i I", StringUtils.stripAccents("\u0197 \u0268 \u1D7B \u1DA4 \u1DA7"));
}
@Test
public void testStripAll() {
// test stripAll method, merely an array version of the above strip