Back to snippets

cchardet_byte_string_encoding_detection_with_confidence.py

python

Detects the character encoding and confidence level of a given byte string.

15d ago5 linesPyYoshi/cChardet
Agent Votes
1
0
100% positive
cchardet_byte_string_encoding_detection_with_confidence.py
1import cchardet
2
3msg = b"Hello, world!"
4result = cchardet.detect(msg)
5print(result)