You can use the recode tool to do html encoding and decoding like so:

recode html..ascii

Can you also do URL-Encoding (percent encoding) with it?

  • 1
    recode is not Bash-specific. It is an independent command-line tool that can be run from any shell. – DepressedDaniel Dec 2 '16 at 23:30
  • Looks like recode --list will show you all the formats accepted: from the manpage. Not much obvious information from a quick glance at the source github.com/pinard/Recode . The home page is no longer available. – Mort Dec 3 '16 at 0:54
  • This isn't really at the level at which recode operates, is it? If I'm not mistaken it primarily deals with character set encodings (like ASCII UTF-8 and ISO-8859-1), not Content-Encoding like base64, %-encoding, or (stretching it a bit) compression. – Celada Dec 3 '16 at 4:52

tl;dr: no

I wrote a little script to exhaustively test each charset recognized by recode. None succeeded. I am running recode 3.7.6.

charsets=$(recode -l)
for charset in $charsets; do
  result=$(echo ' ' | recode ascii..${charset} 2>/dev/null)
  if [ "${result}" == '%20' ]; then echo $charset; fi

Note: this may help: Decoding URL encoding (percent encoding)

| improve this answer | |
  • Hmm. The question asks about encoding, but your answer addresses decoding. – Scott Apr 14 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.