11 releases (4 stable)
Uses old Rust 2015
|2.0.3||Nov 28, 2017|
|2.0.2||Nov 14, 2017|
|2.0.0||Mar 18, 2017|
|2.0.0-pre.1||Oct 30, 2016|
|0.0.2||Nov 20, 2014|
6,056 downloads per month
Used in uchardet
Deprecated in favor of chardet, which is pure Rust. If you have use-case for this code, please feel free to open an issue. Simple PRs will still be read, and possibly accepted.
Attempts to detect the character encoding of raw text using the
// At the top of the file. extern crate uchardet; use uchardet::detect_encoding_name; // Inside a function. assert_eq!("UTF-8", detect_encoding_name(""©français"".as_bytes()).unwrap());
If you also would also like to detect the language used in the decoded text, see rust-cld2.
If you wish, you may install
uchardet using your system package manager.
For example, under Ubuntu, you can run:
sudo apt-get install libuchardet-dev
If you skip this step, Cargo will attempt to compile
uchardet from the
bundled source code instead. This should work if you have an appropriate
g++ (or MSVC) compiler installed, as well as
cmake. We test this build
on Linux, OS X and Windows (both MinGW and MSVC) using Travis CI.
As always, pull requests are welcome! Please keep any patches as simple as possible and include unit tests; that makes it much easier for me to merge them.
If you want to get the C/C++ code building on another platform, please see
uchardef-sys/build.rb and this build script guide.
You'll probably need to adjust some compiler options. Please don't
hesitate to ask questions; I'd love for this library to support more
In your first commit message, please include the following statement:
I dedicate any and all copyright interest in my contributions to this project to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
This allows us to keep the library legally unencumbered, and free for everyone to use.
- Boris-Chengbiao Zhou. Support for newer upstream
uchardetlibraries and Microsoft Windows, plus the error-chain conversion.
- Wesley Moore. Fixes for Rust beta 2 and OS X.
Thank you very much for your contributions!
New code in the
rust-uchardet library is released into the public domain,
as described in the
UNLICENSE file. However, several pre-existing pieces
have their own licenses:
uchardetC++ library include in
uchardet-sys/uchardetvia a git submodule is distributed under the Mozilla Public License 1.1.