| Crates.io | compact-enc-det |
| lib.rs | compact-enc-det |
| version | 0.1.0 |
| created_at | 2025-12-12 14:19:25.373507+00 |
| updated_at | 2025-12-12 14:19:25.373507+00 |
| description | Rust bindings for Compact Encoding Detection (CED) library - detect character encodings in text |
| homepage | https://github.com/greenhat616/compact_enc_det_rs |
| repository | https://github.com/greenhat616/compact_enc_det_rs |
| max_upload_size | |
| id | 1981609 |
| size | 21,554 |
High-level Rust bindings for Compact Encoding Detection (CED) - a library for detecting character encodings in text.
[dependencies]
compact-enc-det = "0.1"
use compact_enc_det::{detect_encoding, DetectHints, Encoding};
fn main() {
let text = "Hello, world! 你好世界";
let detection = detect_encoding(text.as_bytes(), DetectHints::default());
println!("Detected: {:?}", detection.encoding);
println!("MIME name: {}", detection.mime_name);
println!("Reliable: {}", detection.is_reliable);
assert_eq!(detection.encoding, Encoding::UTF8);
}
use compact_enc_det::{detect_encoding, DetectHints, Language, TextCorpusType};
let hints = DetectHints {
url_hint: "https://example.jp/page.html",
language_hint: Some(Language::JAPANESE),
corpus_type: TextCorpusType::WEB_CORPUS,
..Default::default()
};
let detection = detect_encoding(japanese_text, hints);
For complete documentation, see docs.rs/compact-enc-det.
MIT License - see LICENSE file for details.
The underlying C++ library is licensed under Apache License 2.0.