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
--
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
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
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 -
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)
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.
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