def encoding_detect(byte_content):
"""
??????????????, ????, ??? None
:param byte_content: ????????
:type byte_content: bytes
:return: ?????None
:rtype: Union[str, None]
"""
if force_decode_remote_using_encode is not None:
return force_decode_remote_using_encode
if possible_charsets:
for charset in possible_charsets:
try:
byte_content.decode(encoding=charset)
except:
pass
else:
return charset
if cchardet_available: # detect the encoding using cchardet (if we have)
return c_chardet(byte_content)['encoding']
return None
评论列表
文章目录