Re: urllib.urlencode wrongly encoding ± character

Serge Orlov Serge.Orlov at gmail.com
Thu Apr 6 04:03:04 EDT 2006


sleytr at gmail.com 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 with non-ascii characters for a long time. Only rfc 3986 in
2005 said: use utf-8. In the second case browsers submit forms in the
encoding of the page where the form is defined. Most likely that is
what you see when you capture traffic.


> Addition to that, I found lots of page about urlencoding they  have a
> conversation tables or scripts. All of them defines ± as %B1 .

I guess it is because web pages usually serve pretty closed language
communities. Some people just encode urls as latin-1, and it works for
99.9999% of their users. They just don't care that they don't handle
chinese characters since they have no chinese users.


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

It is not clear what you do. Are you interacting with independant 3rd
party web service or you control both server and client?




More information about the Python-list mailing list