Skip to content

Instantly share code, notes, and snippets.

@eliranmal
Created January 23, 2017 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliranmal/0a29d0ef1a990e08ac53844b99224200 to your computer and use it in GitHub Desktop.
Save eliranmal/0a29d0ef1a990e08ac53844b99224200 to your computer and use it in GitHub Desktop.
encode/decode utf strings in bash
#!/usr/bin/env sh
utf_encode() {
printf "\\\x%s" $(printf "$1" | xxd -p -c1 -u)
}
utf_decode() {
printf "%b" "$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment