I think everyone of us heard of URL encoding mechanism - it's basically everywhere.
Given an URLEncoded string on stdin, decode it, and output the decoded form to stdout.
The encoding is very simple,
%20 is representing space. Every percent followed by two hex digits (uppercase or lowercase) has to be replaced with ASCII character code of this number.
100%25+working => 100% working %24+%26+%3C+%3E+%3F+%3B+%23+%3A+%3D+%2C+%22+%27+%7E+%2B+%25 => $ & < > ? ; # : = , " ' ~ + % %414243 => A4243
Test case that fails:
%24%XY+%%% ^~~~~~~ => $
- Loopholes are forbidden.
- If your programming language has built-in function to decode the URL, using it (the function) is forbidden.
- Assume ASCII character set. No Unicode and all that stuff.
- This is a code-golf, so the answer with the fewest bytes used to accomplish the task wins.
- Please include a link to an online interpreter for your code.
- Your program has to decode until EOF or an error (eg. percent without valid hex digits -
%xy) is spotted (you can safetly terminate).
- If anything is unclear, please let me know down in the comments.