From fad95362fbcb3b12e6e8862892c7f2323f6d340c Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 28 Dec 2011 13:08:44 +0100 Subject: Add `unidecode` function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Example: $ unidecode "\x{1D306}" 𝌆 --- .functions | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.functions') diff --git a/.functions b/.functions index 0cdfebc..871275d 100644 --- a/.functions +++ b/.functions @@ -23,4 +23,10 @@ function digga() { function escape() { printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u) echo # newline +} + +# Decode \x{ABCD}-style Unicode escape sequences +function unidecode() { + perl -e "binmode(STDOUT, ':utf8'); print \"$@\"" + echo # newline } \ No newline at end of file -- cgit v1.2.3