Encoding Questions
"Martin v. Löwis"
martin at v.loewis.de
Tue Apr 19 14:47:05 EDT 2005
Kent Johnson wrote:
> Something like
> data = urllib.url_open(...).read()
> unicodeData = data.decode('gb2312')
> utf8Data = unicodeData.encode('utf-8')
>
> You may want to supply the errors parameter to decode() or encode(); see
> the docs for details.
> http://docs.python.org/lib/string-methods.html
In addition, for an HTML page, you might need to update the META element
for the content-type HTTP header. For an XHTML page, you might need to
update/remove the XML declaration.
Regards,
Martin
More information about the Python-list
mailing list