Re: urllib.urlencode wrongly encoding ± character

2006-04-07 Thread Evren Esat Ozkan
I copied and pasted my code to new file and saved with utf-8 encoding. it produced 00090%C2%B1NO%3A%C2%B1H%C2%B1H%C2%B1H%C2%B1H%C2%B1 Than I added "u" to decleration and encode it with iso-8859-1 as you wrote and finally it produced proper result. Your reply is so helped and clarify some things ab

Re: urllib.urlencode wrongly encoding ± character

2006-04-07 Thread Evren Esat Ozkan
Ok, I think this code snippet enough to show what i said; === #!/usr/bin/env python # -*- coding: utf-8 -*- #Change utf-8 to latin-1 #Or move variable decleration to another file than import it val='00090±NO:±H±H±H±H±' from urllib import urlencode data={'key':v

Re: urllib.urlencode wrongly encoding ± character

2006-04-06 Thread Evren Esat Ozkan
I'm just discovered that I don't have to remove that line, just change utf-8 to iso-8859-9 and it worked again. But I want to use utf-8. Please advise... -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.urlencode wrongly encoding ± character

2006-04-06 Thread Evren Esat Ozkan
when I remove "# -*- coding: utf-8 -*-" line from start of the script it worked properly. So I moved variable decleration to another file and imported than it worked too. Now it's working but I dont understand what I'm doing wrong? I'm new to Python and unicode encoding. I'm tried encode/decode

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

Re: urllib.urlencode wrongly encoding ± character

2006-04-06 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > you are right. but when I capture traffic in firefox via > livehttpheaders extension, it shows me that ± is encoded to %B1. It depends on whether user entered url into address bar or clicked on submit button on a page. In the first case there were no standard how to deal

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 urlencod

Re: urllib.urlencode wrongly encoding ± character

2006-04-05 Thread Serge Orlov
[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 b

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