chardet
Crystal bindings for freedesktop.org's uchardet.
Installation
-
Add the dependency to your
shard.yml
:dependencies: chardet: github: elebow/chardet.cr
-
Run
shards install
Usage
require "chardet"
# ...
Chardet.detect(unknown_bytes)
# {encoding: "UTF-8"}
The only public interface is Chardet.detect(Bytes)
. It will return a hash with
a single element:
encoding
(String
) – The detected encoding of the byte stream
Future versions of uchardet are likely to provide additional fields (see https://gitlab.freedesktop.org/uchardet/uchardet/-/issues/5#note_474963).
Contributing
- Fork it (https://github.com/elebow/chardet.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Eddie Lebow - creator and maintainer