Determine the encoding of text
- decode
- encode
- charset
- string
- encoding
- bytes
- str
- chardet
It is impossible to correctly detect the encoding of an arbitrary byte string 100% of the time.
Use the chardet package, or Beautiful Soup’s UnicodeDammit
class to attempt to detect the charset using various heuristics.