urllib.urlencode wrongly encoding ± character

Richard Brodie R.Brodie at rl.ac.uk
Thu Apr 6 06:03:30 EDT 2006


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message 
news:mailman.4161.1144316925.27775.python-list at python.org...

> I'm obviously missing some context here, but "encoding ± to %B1 on any
> platform" is exactly what urlencode does:
>
>    >>> import urllib
>    >>> urllib.urlencode([("key", chr(0xb1))])
>    'key=%B1'

Yeah but you're cheating by using the platform independent chr(0xb1)
instead of a literal '±' in an unspecified encoding. 





More information about the Python-list mailing list