你可以尝试:
r = urllib.urlopen('http://www.elnorte.ec/')
x = BeautifulSoup.BeautifulSoup(r.read)
r.close()
print x.prettify('latin-1')
我得到正确的输出。哦,在这种特殊情况下,您也可以x.__str__(encoding='latin1')
。
我猜这是因为内容在ISO-8859-1(5)中,并且Meta http-equiv内容类型错误地显示为“ UTF-8”。
你能确认吗?