urllib.urlencode wrongly encoding ± character

2006-04-05 Thread sleytr
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. where is this %C2 coming from?

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


Re: urllib.urlencode wrongly encoding ± character

2006-04-05 Thread sleytr
you are right. but when I capture traffic in firefox via
livehttpheaders extension, it shows me that ± is encoded to %B1.
Addition to that, I found lots of page about urlencoding they  have a
conversation tables or scripts. All of them defines ± as %B1 .

realy confused? I can copy and use urlencoded values from firefox, but
I'm realy want to do things with right way.

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


Re: urllib.urlencode wrongly encoding ± character

2006-04-06 Thread sleytr
I have no control over server side.

I'm using Ubuntu Breezy at home and  Ubuntu Dapper at work. Now I'm at
work and same code working properly here! (returning %B1) I'm not sure
and not checked yet but locale settings and/or installed Python version
may be different between two computers.

I think there should be way to encode ± to %B1 on any platform/locale
combination. While searching for a real solution, I'm going to add a
search&destroy filter for %C2 on urlencoded dictionary as a workaround.
Because my queries are constant and %C2 is the only problem for now.

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