mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
utils/web.py: Python 3 should use decode() only if it is a bytes object.
This commit is contained in:
parent
a82ad9cb1a
commit
2eec980c8e
@ -192,7 +192,8 @@ def htmlToText(s, tagReplace=' '):
|
||||
try:
|
||||
import chardet.universaldetector
|
||||
except ImportError:
|
||||
s = s.decode('utf8')
|
||||
if sys.version_info[0] < 3 or isinstance(s, bytes):
|
||||
s = s.decode('utf8')
|
||||
else:
|
||||
u = chardet.universaldetector.UniversalDetector()
|
||||
u.feed(s)
|
||||
|
Loading…
Reference in New Issue
Block a user