Files need to be passed to tomli/tomllib in binary mode
diff --git a/src/buildstream_plugins/sources/cargo.py b/src/buildstream_plugins/sources/cargo.py
index f8ee4d5..fb143ac 100644
--- a/src/buildstream_plugins/sources/cargo.py
+++ b/src/buildstream_plugins/sources/cargo.py
@@ -382,7 +382,7 @@
lockfile = os.path.join(previous_sources_dir, self.cargo_lock)
try:
- with open(lockfile, "r", encoding="utf-8") as f:
+ with open(lockfile, "rb") as f:
try:
lock = tomllib.load(f)
except tomllib.TOMLDecodeError as e: