URL decoding: Difference between revisions
Content deleted Content added
SqrtNegInf (talk | contribs) m →{{header|Raku}}: added output |
|||
Line 915: | Line 915: | ||
<pre> "http://foo bar/"</pre> |
<pre> "http://foo bar/"</pre> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
||
<lang mathematica>URLDecoding[url_] := |
<lang mathematica>URLDecoding[url_] := |
||
StringReplace[url, "%" ~~ x_ ~~ y_ :> FromDigits[x ~~ y, 16]] //. |
StringReplace[url, "%" ~~ x_ ~~ y_ :> FromDigits[x ~~ y, 16]] //. |
||
StringExpression[x___, Longest[n__Integer], y___] :> |
StringExpression[x___, Longest[n__Integer], y___] :> |
||
StringExpression[x, FromCharacterCode[{n}, "UTF8"], y]</lang> |
StringExpression[x, FromCharacterCode[{n}, "UTF8"], y]</lang> |
||
Example use: |
Example use: |
||
<lang mathematica>URLDecoding["http%3A%2F%2Ffoo%20bar%2F"]</lang> |
<lang mathematica>URLDecoding["http%3A%2F%2Ffoo%20bar%2F"]</lang> |
||
{{out}} |
{{out}} |
||
<pre>http://foo bar/</pre> |
<pre>http://foo bar/</pre> |