elebow / chardet.cr

Crystal bindings for freedesktop.org's libuchardet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chardet

Crystal bindings for freedesktop.org's uchardet.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      chardet:
        github: elebow/chardet.cr
  2. 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

  1. Fork it (https://github.com/elebow/chardet.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

About

Crystal bindings for freedesktop.org's libuchardet.

License:MIT License


Languages

Language:Crystal 100.0%