--- a/src/util.rs	2006-07-24 03:21:28.000000000 +0200
+++ b/src/util.rs	2024-03-21 14:59:03.494909986 +0100
@@ -46,8 +46,9 @@
     static LIB_CRATE_MOD_PATH: Lazy<Result<String, String>> = Lazy::new(|| {
         let file = manifest_path()?;
         let cargo_toml_bytes = fs::read(file).map_err(|e| e.to_string())?;
-
-        let cargo_toml = toml::from_slice::<CargoToml>(&cargo_toml_bytes)
+        let cargo_toml_string = String::from_utf8(cargo_toml_bytes)
+            .map_err(|e| format!("Could not UTF-8 decode `Cargo.toml`: {e}"))?;
+        let cargo_toml = toml::from_str::<CargoToml>(&cargo_toml_string)
             .map_err(|e| format!("Failed to parse `Cargo.toml`: {e}"))?;
 
         let lib_crate_name = cargo_toml
