Re: Get document as normal text and not as binary data

2005-03-28 Thread Markus Franz
Diez B. Roggisch wrote: You get what the server sends. That is always binary - either it _is_ a binary file, or maybe in an unknown encoding. And how can I convert those binary data to a normal string with normal characters? Best regards Markus --

Re: Get document as normal text and not as binary data

2005-03-28 Thread Diez B. Roggisch
Markus Franz wrote: Diez B. Roggisch wrote: You get what the server sends. That is always binary - either it _is_ a binary file, or maybe in an unknown encoding. And how can I convert those binary data to a normal string with normal characters? There is no normal - it's just bytes, and

Re: Get document as normal text and not as binary data

2005-03-28 Thread Diez B. Roggisch
Addendum: If you give us the url you're fetching data from, we might be able to look at the delivered data ourselves. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Get document as normal text and not as binary data

2005-03-28 Thread Kent Johnson
Markus Franz wrote: Hi. I used urllib2 to load a html-document through http. But my problem is: The loaded contents are returned as binary data, that means that every character is displayed like lt, for example. How can I get the contents as normal text? My guess is the html is utf-8 encoded -

Get document as normal text and not as binary data

2005-03-27 Thread Markus Franz
Hi. I used urllib2 to load a html-document through http. But my problem is: The loaded contents are returned as binary data, that means that every character is displayed like lÀÃt, for example. How can I get the contents as normal text? My script was: import urllib2 req = urllib2.Request(url)

Re: Get document as normal text and not as binary data

2005-03-27 Thread Diez B. Roggisch
Markus Franz wrote: Hi. I used urllib2 to load a html-document through http. But my problem is: The loaded contents are returned as binary data, that means that every character is displayed like lÀÃt, for example. How can I get the contents as normal text? You get what the server sends.

Re: Get document as normal text and not as binary data

2005-03-27 Thread Fredrik Lundh
Markus Franz wrote: I used urllib2 to load a html-document through http. But my problem is: The loaded contents are returned as binary data, that means that every character is displayed like lÃ?Ãt, for example. How can I get the contents as normal text? My script was: import urllib2 req