Awesome
chardetng_py
Features
Python binding for the chardetng character encoding detector.
Documentation
Documentation for the latest release can be found on Read the Docs.
Platform and Architecture Support
Compatability is a feature of chardetng_py
. The goal is to support as many platforms and architectures as possible.
chardetng_py
supports Python 3.8, 3.9, 3.10, 3.11, and 3.12 on Linux, macOS 10.7, macOS 11.0, and Windows. Additionally, PyPy versions 3.8, 3.9, and 3.10 are supported on Linux.
The x86, x86_64, s390x, ARMv7l, and AArch64 architectures are supported on Linux for both cPython and PyPy. The AArch64 and x86_64 architectures are supported on macOS. The x86_64 architecture is supported on Windows.
In short, if you can install Python 3.8, you should be able to install chardetng_py
.
If there is a platform or architecture that you would like to see supported, please file an issue.
This support is largely due to the wonderful maturin project.
Installation
You can install chardetng_py
via pip from PyPI:
$ pip install chardetng-py
Or via poetry:
$ poetry add chardetng-py
Quick Start
The easiest way to get started is to use the :meth:detect
method.
>>> from chardetng_py import detect
>>> detect(b'Jakby r\xeaka Boga')
'windows-1254'
There is also a detect
method available for compatability with chardet
,
but it will always report None
for the language. The confidence value will either
be 0.99
or 0.01
depending on whether chardetng returns a "high" or "low"
confidence boolean.
>>> from chardetng_py.compat import detect
>>> detect(b'Jakby r\xeaka Boga')
{'encoding': 'windows-1254', 'confidence': 0.99, 'language': None}
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license,
chardetng_py
is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.