from urllib.request import urlopen url = 'http://ya.ru/' data = urlopen(url).read() print(data.decode('utf-8', errors='ignore'))
Появляется ошибка:
UnicodeEncodeError: ‘charmap’ codec can't encode character ‘\xa9’ in position 6711: character maps to <undefined>
Хотя передается параметр errors='ignore'
Если попробовать декодировать так:
print(b'\xa9SPAM'.decode('utf-8', errors='ignore'))
В чем может быть причина, что не срабатывает errors='ignore' в первом случае?