Martin, to his credit, solved it the hard way.
Here's the hard way in python (slightly modified version of the
unquote function from
the library.)

#!/usr/bin/env python

import sys

def unquote(s):
    """unquote('abc%20def') -> 'abc def'."""
    ls = s.split('%')
    res = [ls[0]]
    myappend = res.append
    del ls[0]
    for item in ls:
        if item[1:2]:
            try:
                myappend(chr(int(item[:2], 16))
                     + item[2:])
            except ValueError:
                myappend('%' + item)
        else:
            myappend('%' + item)
    return "".join(res)

print unquote(sys.stdin.read())

Cheers,
Carl.

On 31/08/05, Carl Cerecke <[EMAIL PROTECTED]> wrote:
> OK. Here's python.
> 
> #!/usr/bin/env python
> import urllib, sys
> print urllib.unquote(sys.stdin.read())
> 
> 
> Cheers,
> Carl.
>

Reply via email to