PTT
Submit
Submit
选择语言
正體中文
简体中文
PTT
Python
[问题] Unicode Decode Error
楼主:
suhang
(suhang)
2014-10-29 13:29:15
我写了一个crawler爬网页
http://pastie.org/9682499#16,18
按照view page source <meta content="text/html; charset=Big5">
我用Big5 解码回传的 byte string
Python却回应某些byte无法解码
UnicodeDecodeError: 'big5' codec can't decode byte 0x82 in position 983:
illegal multibyte sequence
1
浏览器也是设定Big5解码
那为什么浏览器可以正确的显现所有内容?
2
我试着用utf8瞎猜去解码,一样有error
请问我该如何处理这个错误而能显示我所抓下来的网页?
作者:
alibuda174
(阿哩不达)
2014-10-29 13:41:00
please provide more info, code, and error messages0x82处于Big5编码的使用者造字区里 看来Python的Big5 codec不支援这些东西 浏览器可正常显示是因为它们也扩充支援那些字符了(Unicode补完计画?)嗯 或许可以呼叫外部程式(能从Big5转成utf8)或参考
https://gist.github.com/andycjw/5617496
继续阅读
Re: [问题] txt内容切割加总
ypcat
Re: [问题] 关于用matplotlib如何把资料丢进图里
ccwang002
[问题] 关于用matplotlib如何把资料丢进图里
Nccu3631
[资讯] 10 月底的 Taipei.py
timTan
[问题] omniORBpy
gts2590
[问题] time.sleep 是否会占用资源?
python27
[问题] 从网页抓资料,中文处理上的问题
elmo56
[问题] .items()
seiryou
Re: [问题] 搜寻 nested list 中的字串
yauhh
Re: [问题] 搜寻 nested list 中的字串
bigpigbigpig
Links
booklink
Contact Us: admin [ a t ] ucptt.com