Anonymous user
URL decoding: Difference between revisions
→{{header|AWK}}
No edit summary |
|||
Line 303:
<pre>
http%3A%2F%2Ffoo%20bar%2F
http://foo bar/
</pre>
<lang awk>
LC_ALL=C
echo "http%3A%2F%2Ffoo%20bar%2F" | gawk -vRS='%[[:xdigit:]]{2}' '
RT {RT = sprintf("%c",strtonum("0x" substr(RT, 2)))}
{gsub(/+/," ");printf "%s", $0 RT}'
</lang>
{{out}}
<pre>
http://foo bar/
</pre>
|