对于刚刚接触python爬虫的人,常常会碰到一个比较烦的问题,

如果网页是GB2312编码格式,我们直接decode(’GB2312‘)一般python都会报错:

GB2312不能编码该页面。

这就比较奇怪了

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

网页的charset明明是GB2312,却出错了。

事实上微软将 gb2312 和 gbk 统一映射为 gb18030,这个问题也比较无语大家可以参考:

 

http://powerelite.blog.163.com/blog/static/429658912014394820777/

相关文章:

  • 2021-08-07
  • 2022-02-07
  • 2021-11-18
  • 2021-12-19
  • 2022-01-10
  • 2021-05-08
  • 2021-06-25
  • 2021-09-13
猜你喜欢
  • 2021-06-14
  • 2021-12-25
  • 2021-08-09
  • 2021-11-19
  • 2021-04-12
  • 2022-12-23
  • 2021-12-29
相关资源
相似解决方案