mosmix 0.1.0

Contains a database of all mosmix weather-stations.
1
2
3
4
5
6
7
8
9
10
11
12
use encoding_rs::WINDOWS_1252;
use std::fs::File;
use std::io::Read;
use std::path::Path;

pub fn read_win_1252_file(path: &Path) -> Result<String, std::io::Error> {
    let mut file = File::open(path)?;
    let mut buffer = Vec::new();
    file.read_to_end(&mut buffer)?;
    let (cow_str, _encoding_used, _had_errors) = WINDOWS_1252.decode(&buffer);
    Ok(cow_str.into_owned())
}