Associate code example for Character Encodings and Detection with Python, chardet, and cchardet.
Clone this repository, then cd into the directory.
I suggest creating a virtual environment and installing cchardet. Something like the following should work:
python3 -m venv .venv
. .venv/bin/activate
pip install cchardetIf new to virtual environments, feel free to read my article on the subject.
python detect.py sample-latin1.csvThe code assumes Python 3. You may need to use python3 in place of python above.
Feel free to use your own text files, and analyze and adapt the code.
Please feel free to submit pull requests and/or open issues.
Copyright 2020 Jonathan Bowman. All documentation and code contained in this repository may be freely shared in compliance with the Apache License, Version 2.0, and is provided “AS IS” without warranties or conditions of any kind.