在Python中将字节解码为utf-8:'errors =“ignore”'无效

时间:2017-01-03 19:37:49

标签: python utf-8 decode

代码:

def reqURL():
    request = urllib.request.urlopen('https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat')
    html = request.read()
    html = html.decode(encoding="utf-8", errors="ignore")
    print(html)

错误:

UnicodeEncodeError: 'charmap' codec can't encode character '\u017d' in position 468663: character maps to <undefined>

问题: 我阅读了docs并将errors="ignore"放入我的代码中,但它无效!为什么呢?

0 个答案:

没有答案