BASH: Unescape url-encoded string

It’s actually simple: $ export ESCAPED="%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82%2C+fuf" $ echo "$(echo -e "$(echo "$ESCAPED" | sed 's/+/%20/g' | sed 's/%/\\x/g')")" русский текст, fuf
In practice, for example, using with url decoding: $ function urldecode() { echo "$(echo -e "$(echo "$1" | sed 's/+/%20/g' | sed 's/%/\\x/g')")"; } $ urldecode "http%3A%2F%2Fbash.im%2F" http://bash.im/ Wuala.