Permalink
Browse files

Add `unidecode` function

Example:

    $ unidecode "\x{1D306}"
    𝌆
  • Loading branch information...
mathiasbynens committed Dec 28, 2011
1 parent e3c4b0e commit fad95362fbcb3b12e6e8862892c7f2323f6d340c
Showing with 6 additions and 0 deletions.
  1. +6 −0 .functions
View
@@ -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
}

0 comments on commit fad9536

Please sign in to comment.