def test_detectencoding2(self): url = 'g1.globo.com' response = crawler.download(url) data = response.read() charset = crawler.detectcharset(response.info(), data) self.assertEqual(charset, 'utf-8') data.decode(charset)
def test_detectencoding(self): response = crawler.download(self.url) data = response.read() charset = crawler.detectcharset(response.info(), data) self.assertEqual(charset, 'iso-8859-1') data.decode(charset)