Skip to content

Crystal bindings for freedesktop.org's libuchardet.

License

Notifications You must be signed in to change notification settings

elebow/chardet.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published