4

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?

hgiesel
  • 312
  • 1
    recode is not Bash-specific. It is an independent command-line tool that can be run from any shell. – DepressedDaniel Dec 02 '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 https://github.com/pinard/Recode . The home page is no longer available. – Mort Dec 03 '16 at 00: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 03 '16 at 04:52

1 Answers1

1

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
done

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

SGDave
  • 11