diff --git a/src/main/java/com/github/jlangch/venice/impl/functions/StringFunctions.java b/src/main/java/com/github/jlangch/venice/impl/functions/StringFunctions.java index bf0e9f727..d2e949873 100644 --- a/src/main/java/com/github/jlangch/venice/impl/functions/StringFunctions.java +++ b/src/main/java/com/github/jlangch/venice/impl/functions/StringFunctions.java @@ -2939,6 +2939,8 @@ public VncVal apply(final VncList args) { "(h/dump (bytebuf-from-string (str/normalize-utf \"\\u00FC\" :NFD))) \n" + ";; 00000000: 75cc 88 u.. \n" + "``` ") + .seeAlso( + "io/file-normalize-utf") .build() ) { @Override diff --git a/src/test/java/com/github/jlangch/venice/impl/functions/IOFunctionsTest.java b/src/test/java/com/github/jlangch/venice/impl/functions/IOFunctionsTest.java index f4fda9960..633f99b96 100644 --- a/src/test/java/com/github/jlangch/venice/impl/functions/IOFunctionsTest.java +++ b/src/test/java/com/github/jlangch/venice/impl/functions/IOFunctionsTest.java @@ -24,6 +24,7 @@ import static com.github.jlangch.venice.impl.util.StringUtil.to_lf; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -291,6 +292,36 @@ public void test_io_file_ext() { } } + @Test + public void test_io_file_normalize_utf_1() { + final Venice venice = new Venice(); + + final String script = "(io/file-path (io/file \"/test_\\u00FC.txt\")))"; + + assertEquals("/test_ü.txt", venice.eval(script)); + } + + @Test + public void test_io_file_normalize_utf_2() { + final Venice venice = new Venice(); + + final String script1 = "(io/file-path (io/file \"/test_u\\u0308.txt\")))"; + assertNotEquals("/test_ü.txt", venice.eval(script1)); + + final String script2 = "(io/file-path (io/file \"/test_u\\u0308.txt\")))"; + assertEquals("/test_u\u0308.txt", venice.eval(script2)); + } + + @Test + public void test_io_file_normalize_utf_3() { + final Venice venice = new Venice(); + + final String script = "(== \"/test_\\u00FC.txt\"" + + " (io/file-path (io/file-normalize-utf \"/test_u\\u0308.txt\")))"; + + assertTrue((Boolean)venice.eval(script)); + } + @Test public void test_io_file_within_dir_Q() { final Venice venice = new Venice();