Skip to content

Commit

Permalink
transcode to utf8
Browse files Browse the repository at this point in the history
especially useful in Windows, as the default encoding in WIndows is UTF16-LE and qsv expects UTF8
  • Loading branch information
jqnatividad committed Mar 8, 2022
1 parent e9d77e5 commit db9bb8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::io::{self, Read};
use std::ops::Deref;
use std::path::PathBuf;

use encoding_rs_io::DecodeReaderBytes;
use serde::de::{Deserialize, Deserializer, Error};

use crate::index::Indexed;
Expand Down Expand Up @@ -298,7 +299,10 @@ impl Config {
Ok(match self.path {
None => Box::new(io::stdin()),
Some(ref p) => match fs::File::open(p) {
Ok(x) => Box::new(x),
Ok(x) => {
let transcoded = DecodeReaderBytes::new(x);
Box::new(transcoded)
}
Err(err) => {
let msg = format!("failed to open {}: {}", p.display(), err);
return Err(io::Error::new(io::ErrorKind::NotFound, msg));
Expand Down

0 comments on commit db9bb8a

Please sign in to comment.