{"id":5221,"library":"faust-cchardet","title":"faust-cchardet","description":"faust-cchardet is a high-speed universal character encoding detector, acting as a binding to the `uchardet` library. It is an actively maintained fork of the original, unmaintained `cChardet` project. The library provides efficient character set detection for various languages and encodings. It is currently at version 2.1.19, with a release cadence primarily driven by build improvements and Python version compatibility updates.","status":"active","version":"2.1.19","language":"en","source_language":"en","source_url":"https://github.com/faust-streaming/cChardet","tags":["encoding","chardet","detection","fast","uchardet"],"install":[{"cmd":"pip install faust-cchardet","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The package name is `faust-cchardet` but the top-level module it exposes is `cchardet`.","wrong":"import faust_cchardet as chardet","symbol":"detect","correct":"import cchardet as chardet\nresult = chardet.detect(byte_string)"}],"quickstart":{"code":"import cchardet as chardet\n\n# Example 1: Detect encoding of a known byte string\ntext_bytes_utf8 = b\"Hello, world!\\xc3\\xa9 This has a \\xc3\\xa9 character.\"\nresult_utf8 = chardet.detect(text_bytes_utf8)\nprint(f\"UTF-8 example: {result_utf8}\")\n\ntext_bytes_latin1 = \"Français\".encode('latin-1')\nresult_latin1 = chardet.detect(text_bytes_latin1)\nprint(f\"Latin-1 example: {result_latin1}\")\n\n# The result is a dictionary containing 'encoding', 'confidence', and 'language'.","lang":"python","description":"This example demonstrates how to import `cchardet` and use its `detect` function to identify the encoding of a byte string."},"warnings":[{"fix":"Ensure `pip install faust-cchardet` is used, and check your `requirements.txt` or `pyproject.toml` to specify `faust-cchardet`.","message":"This library is a fork of the original `cchardet` project, which is no longer maintained and can have build issues, especially with newer Python versions or operating systems. Always install `faust-cchardet` for the actively maintained version.","severity":"gotcha","affected_versions":"All versions, when attempting to use the original `cchardet` package."},{"fix":"Use `import cchardet as chardet` (or just `import cchardet`) in your code after installing `faust-cchardet`.","message":"The Python package name is `faust-cchardet`, but the module you import in your Python code is `cchardet`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to Python 3.x if using `faust-cchardet` version 2.1.6 or newer. Previous versions (2.1.5 and earlier) might still support Python 2.7, but are not recommended due to lack of maintenance and security updates.","message":"Python 2.7 support was dropped in version 2.1.6.","severity":"breaking","affected_versions":"2.1.6 and later"},{"fix":"Refer to `faust-cchardet` documentation for its specific API and version compatibility. Do not assume `chardet` library changes apply directly.","message":"`faust-cchardet` provides C bindings to `uchardet` for performance. Do not confuse it with the pure Python `chardet` library, which has its own breaking changes and API differences (e.g., in `chardet` 7.0.0, Python 3.7-3.9 support was dropped, which may not apply to `faust-cchardet`).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}