URL decoding: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(UNIX Shell: add alternative: printf -> echo) |
||
Line 1,708: | Line 1,708: | ||
<syntaxhighlight lang="bash">urldecode() { local u="${1//+/ }"; printf '%b' "${u//%/\\x}"; }</syntaxhighlight> |
<syntaxhighlight lang="bash">urldecode() { local u="${1//+/ }"; printf '%b' "${u//%/\\x}"; }</syntaxhighlight> |
||
Alternative: Replace <code>printf '%b' "${u//%/\\x}"</code> with <code>echo -e "${u//%/\\x}"</code> |
|||
Example: |
Example: |
||
Line 1,717: | Line 1,719: | ||
google.com/search?q=`Abdu'l-Bahároot@ |
google.com/search?q=`Abdu'l-Bahároot@ |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
<syntaxhighlight lang="bash">function urldecode |
<syntaxhighlight lang="bash">function urldecode |