Skip to content

Commit

Permalink
a hacky way of detecting cp1251
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Nov 12, 2023
1 parent 8692397 commit 23e55ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src-tauri/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ pub fn decode_buffer(buf: Vec<u8>) -> String {
let mut str_encoding = charset2encoding(&result.0);
// let's just say it's cp1251 if encoding is not detected
// FIXME: find a way to actually detect cp1251 and cp1252 from together

if result.0 == "KOI8-R" && result.1 < 0.7 && result.2 == "Russian" {
str_encoding = "cp1251";
}

if str_encoding.len() < 1 {
str_encoding = "cp1251";
}
Expand Down

0 comments on commit 23e55ef

Please sign in to comment.