diff --git a/include/Utils.awk b/include/Utils.awk index df1cfdff..f2f11eed 100644 --- a/include/Utils.awk +++ b/include/Utils.awk @@ -211,11 +211,10 @@ function base64(text, command, temp) { return temp } -# Print a Unicode-escaped string. (GNU only) -# FIXME: find a BSD/macOS equivalent +# Print a Unicode-escaped string. (requires GNU Bash) # NOTE: can only be ran once for each text! Build a cache. function uprintf(text, command, temp) { - command = "printf" - (command " -- " parameterize(text) | getline temp) + command = "echo -en " parameterize(text) + ("bash -c " parameterize(command, "\"")) | getline temp return temp } diff --git a/test/TestUtils.awk b/test/TestUtils.awk index 8a463c23..08bb2e9e 100644 --- a/test/TestUtils.awk +++ b/test/TestUtils.awk @@ -65,10 +65,10 @@ BEGIN { assertEqual(base64("ninja"), "bmluamE=") } - #T("uprintf", 1) - #{ - # assertEqual(uprintf("Ma\\u00f1ana"), "Mañana") - #} + T("uprintf", 1) + { + assertEqual(uprintf("Ma\\u00f1ana"), "Mañana") + } END_TEST() }