This task   (the reverse of   URL encoding   and distinct from   URL parser)   is to provide a function
or mechanism to convert an URL-encoded string into its original unencoded form.



Test cases

   The encoded string   "http%3A%2F%2Ffoo%20bar%2F"   should be reverted to the unencoded form   "http://foo bar/".
   The encoded string   "google.com/search?q=%60Abdu%27l-Bah%C3%A1"   should revert to the unencoded form   "google.com/search?q=`Abdu'l-Bahá".


      PRINT FNurldecode("http%3A%2F%2Ffoo%20bar%2F")
      END
 
      DEF FNurldecode(url$)
      LOCAL i%
      REPEAT
        i% = INSTR(url$, "%", i%+1)
        IF i% THEN
          url$ = LEFT$(url$,i%-1) + \
          \      CHR$EVAL("&"+FNupper(MID$(url$,i%+1,2))) + \
          \      MID$(url$,i%+3)
        ENDIF
      UNTIL i% = 0
      = url$
 
      DEF FNupper(A$)
      LOCAL A%,C%
      FOR A% = 1 TO LEN(A$)
        C% = ASCMID$(A$,A%)
        IF C% >= 97 IF C% <= 122 MID$(A$,A%,1) = CHR$(C%-32)
      NEXT
      = A$