vendredi 25 septembre 2015

sed decodes html encoding. Need explanation how

Following sed expression decodes HTML URL Encoding (exactly as required): sed 's/%/\x/g' HTML encoding reference can be found here: http://ift.tt/1iJoiug

However, I can't get how it works. Regex seems to say: find "%" and replace it by "\x" in the string, but it does much more then that. Why does it do decoding here ?

Example:
$ echo "This%20%2C%20character%20is%20comma" | echo -e "$(sed 's/%/\\x/g')"
This , character is comma




Aucun commentaire:

Enregistrer un commentaire