ksud: fix encoding error

This commit is contained in:
tiann
2023-01-04 17:26:21 +08:00
parent d8f5d74ec3
commit 3280c6af2e
3 changed files with 7 additions and 3 deletions

View File

@@ -421,6 +421,7 @@ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
"const_format", "const_format",
"encoding",
"env_logger", "env_logger",
"java-properties", "java-properties",
"log", "log",

View File

@@ -19,6 +19,7 @@ env_logger = "0.10.0"
serde = { version = "1.0" } serde = { version = "1.0" }
serde_json = "1.0" serde_json = "1.0"
regex = "1.5.4" regex = "1.5.4"
encoding = "0.2.33"
[profile.release] [profile.release]
strip = true strip = true

View File

@@ -374,9 +374,11 @@ fn do_list_modules(path: &str) -> Vec<HashMap<String, String>> {
continue; continue;
}; };
let mut module_prop_map = HashMap::new(); let mut module_prop_map = HashMap::new();
let result = PropertiesIter::new(Cursor::new(content)).read_into(|k, v| { let encoding = encoding::all::UTF_8;
module_prop_map.insert(k, v); let result =
}); PropertiesIter::new_with_encoding(Cursor::new(content), encoding).read_into(|k, v| {
module_prop_map.insert(k, v);
});
// Add enabled, update, remove flags // Add enabled, update, remove flags
let enabled = !path.join(defs::DISABLE_FILE_NAME).exists(); let enabled = !path.join(defs::DISABLE_FILE_NAME).exists();