From 23e55efb5088586c43af02c9b3d324df3d8161c1 Mon Sep 17 00:00:00 2001 From: iAmir Date: Sun, 12 Nov 2023 15:03:43 +0330 Subject: [PATCH] a hacky way of detecting cp1251 --- src-tauri/src/helpers.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-tauri/src/helpers.rs b/src-tauri/src/helpers.rs index 64864064..7f76fd2c 100644 --- a/src-tauri/src/helpers.rs +++ b/src-tauri/src/helpers.rs @@ -7,6 +7,11 @@ pub fn decode_buffer(buf: Vec) -> 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"; }