Re: Convert dictionary to HTTP POST

2006-03-05 Thread Laszlo Zsolt Nagy
>>The values of some inputs are encoded using html entities. >>How can I decode a string like "Bessy's cat" in "Bessy's cat"? >> >> > >this snippet might help: > >http://effbot.org/zone/re-sub.htm#strip-html > > Thank you, worked like a charm. :-) Laszlo -- http://mail.python.org/m

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: > The values of some inputs are encoded using html entities. > How can I decode a string like "Bessy's cat" in "Bessy's cat"? this snippet might help: http://effbot.org/zone/re-sub.htm#strip-html -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Kent Johnson
Laszlo Zsolt Nagy wrote: > The values of some inputs are encoded using html entities. > How can I decode a string like "Bessy's cat" in "Bessy's cat"? http://groups.google.com/group/comp.lang.python/browse_frm/thread/819731a536a4c1a2/fce6c2f6c3d46e9c?q=htmlentitydefs&rnum=2#fce6c2f6c3d46e9c Kent

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
> Well I don't understand what's encoding the apostrophe as an encoded > entity anyway. That's only supposed to be done for HTML content, not > form content. You are right. I was wrong. The problem was not with quote. It was reading out the VALUE of an INPUT from HTML source. > How about an

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Sybren Stuvel
Laszlo Zsolt Nagy enlightened us with: > The values of some inputs are encoded using html entities. How can > I decode a string like "Bessy's cat" in "Bessy's cat"? This should help: http://docs.python.org/lib/module-htmlentitydefs.html Sybren -- The problem with the world is stupidity. Not sa

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Steve Holden
[copied to list] Laszlo Zsolt Nagy wrote: >> >> >> See urllib.urlencode(). No idea why they don't include it in urllib2 >> as well, but there you go. >> >> >>> from urllib import urlencode >> >>> urlencode({'a':'& "Simple string"', 'b': '<>[EMAIL PROTECTED]&*()_+='}) >> 'a=%26+%22Simple+string%22

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
> > >See urllib.urlencode(). No idea why they don't include it in urllib2 as >well, but there you go. > > >>> from urllib import urlencode > >>> urlencode({'a':'& "Simple string"', 'b': '<>[EMAIL PROTECTED]&*()_+='}) >'a=%26+%22Simple+string%22&b=%3C%3E%21%40%23%24%25%5E%26%2A%28%29_%2B%3D' > >>>

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Steve Holden
Laszlo Zsolt Nagy wrote: > Hello, > > How can I convert a dictionary into a HTTP POST string? > I have an example below, but this is not working correctly for special > characters. (" ' and others). In other words, if I use "Bessy's cat" > instead of "Bessy" then the http server will parse tha

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Sybren Stuvel
Laszlo Zsolt Nagy enlightened us with: > How can I convert a dictionary into a HTTP POST string? I have an > example below, but this is not working correctly for special > characters. (" ' and others). URL-quote it. > In other words, if I use "Bessy's cat" instead of "Bessy" then the > http serv

Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
Hello, How can I convert a dictionary into a HTTP POST string? I have an example below, but this is not working correctly for special characters. (" ' and others). In other words, if I use "Bessy's cat" instead of "Bessy" then the http server will parse that to "Bessy's cat" Probably the prob