[EMAIL PROTECTED] wrote:
> Hi,  I'm trying to make a gui for a web service. Site using ±
> character in value of some fields. But I can't encode this character
> properly.
>
>
> >>> data = {'key':'±'}
> >>> urllib.urlencode(data)
> 'key=%C2%B1'
>
> but it should be only %B1 not %C2%B1.

It should be %C2%B1, because de-facto urls are encoded as utf-8. I've
just tried entering ± into four input field: firefox 1.5 search
toolbar, www.google.com search in firefox 1.5, google toolbar in IE 6,
www.google.com search in IE 6. Everywhere ± is encoded as %C2%B1. In
older browsers YMMV.

> where is this %C2 coming from?

Your console must be utf-8.
>>> u'±'.encode('utf-8')
'\xc2\xb1'

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to