Похоже, что оригинальный файл находится в UTF-16.
По какой-либо причине BeautifulSoup(..., from_encoding='utf-16le')
не понимает эту ситуацию, но вы можете обойти эту проблему, прочитав и расшифровав файл вручную перед передачей его в BS.
Ниже приведена расшифровка.где я создаю HTML-файл UTF-16LE, выгружаю его содержимое, пытаюсь передать его непосредственно в BS4 и, наконец, использую обходной путь, описанный выше.
$ echo '<html><div>hello</div></html>' | iconv -f utf-8 -t utf-16le > y.html
$ file y.html
$ xxd y.html
00000000: 3c00 6800 7400 6d00 6c00 3e00 3c00 6400 <.h.t.m.l.>.<.d.
00000010: 6900 7600 3e00 6800 6500 6c00 6c00 6f00 i.v.>.h.e.l.l.o.
00000020: 3c00 2f00 6400 6900 7600 3e00 3c00 2f00 <./.d.i.v.>.<./.
00000030: 6800 7400 6d00 6c00 3e00 0a00 h.t.m.l.>...
$ python
>>> import bs4
>>> s = bs4.BeautifulSoup(open('y.html'))
<html><div>hello</div></html>
>>> s = bs4.BeautifulSoup(open('y.html'), from_encoding='utf-16le')
<html><div>hello</div></html>
>>> s = bs4.BeautifulSoup(open('y.html'), 'html.parser', from_encoding='utf-16le')
<html><div>hello</div></html>
>>> d = open('y.html', 'rb').read().decode('utf-16le')
>>> d
'<html><div>hello</div></html>\n'
>>> s = bs4.BeautifulSoup(d)
>>> s
<html><div>hello</div></html>
>>>