diff --git a/lila/src/main/scala/StringOps.scala b/lila/src/main/scala/StringOps.scala index db52e7c..aa44205 100644 --- a/lila/src/main/scala/StringOps.scala +++ b/lila/src/main/scala/StringOps.scala @@ -61,7 +61,9 @@ object StringOps: // weird stuff https://www.compart.com/en/unicode/block/U+2000 (c >= '\u2028' && c <= '\u202F') || // Hangul fillers - (c == '\u115f' || c == '\u1160') + (c == '\u115f' || c == '\u1160') || + // braille space https://unicode-explorer.com/c/2800 + (c == '\u2800') object normalize: diff --git a/lila/src/test/scala/StringOpsTest.scala b/lila/src/test/scala/StringOpsTest.scala index 2d54493..d0fd67d 100644 --- a/lila/src/test/scala/StringOpsTest.scala +++ b/lila/src/test/scala/StringOpsTest.scala @@ -46,3 +46,12 @@ class StringTest extends munit.FunSuite: assertEquals(normalize("keep º and ª"), "keep º and ª") test("normalize preserve half point"): assertEquals(normalize("½"), "½") + + test("invisible chars"): + // normal space + assertEquals(softCleanUp(" "), "") + assertEquals(softCleanUp(" "), "") + // braille space + assertEquals(softCleanUp("⠀"), "") + assertEquals(softCleanUp("⠀⠀⠀"), "") + assertEquals(softCleanUp("⠀uh⠀⠀"), "uh")