Encoding

Lad python at hope.cz
Mon Feb 13 13:03:01 EST 2006


I have a script that uses utf-8 encoding. Now I would like to send some
data to an application ( on another server) that uses 1250 encoding.
How can I tell the server that the coming data will be in utf-8 code?
I tried this
params='some data'
h = httplib.HTTP(self.host)
h.putheader("Content-type", "multipart/form-data;
boundary=---------------------------7d329422844")
h.putheader("Content-length", "%d" % len(params))
h.putheader("Accept-Language", "us-en")
h.putheader('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*')
h.putheader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.1)')
h.putheader('Host', 'server')
h.endheaders()
.....
....

but it doesn't work. The data are not encoded properly
Thanks for help
L.B.




More information about the Python-list mailing list