Rust-Chardet
Rust version of chardet.
Usage
Put this in your Cargo.toml
:
[]
= "0.2"
Then put this in your crate root:
extern crate chardet;
Using with encoding:
extern crate chardet;
extern crate encoding;
use chardet;
use OpenOptions;
use *;
use DecoderTrap;
use encoding_from_whatwg_label;
// open text file
let mut fh = new.read.open.expect;
let mut reader: = Vec new;
// read file
fh.read_to_end.expect;
// detect charset of the file
let result = detect;
// result.0 Encode
// result.1 Confidence
// result.2 Language
// decode file into utf-8
let coder = encoding_from_whatwg_label;
if coder.is_some