Skip to content

The agent that grows with you

fix: read text files with encoding=utf-8-sig in code merged from main

ethernet45c77a40cfcf
diff --git a/cron/bot_chat_delivery.py b/cron/bot_chat_delivery.py
index 2e637983a8f..3b68d469df5 100644
--- a/cron/bot_chat_delivery.py
+++ b/cron/bot_chat_delivery.py
@@ -28,7 +28,7 @@ def _root() -> Path:
def read_pending(key: str) -> dict | None:
"""Exact-id read: fails closed on anything but a JSON object, never licensing an overwrite."""
try:
- record = json.loads((_root() / f"{key}.json").read_text(encoding="utf-8"))
+ record = json.loads((_root() / f"{key}.json").read_text(encoding="utf-8-sig"))
except FileNotFoundError:
return None
if not isinstance(record, dict):
@@ -40,7 +40,7 @@ def _records(root: Path) -> list[tuple[Path, dict]]:
records = []
for path in root.glob("*.json"):
try:
- record = json.loads(path.read_text(encoding="utf-8"))
+ record = json.loads(path.read_text(encoding="utf-8-sig"))
if not isinstance(record, dict):
raise ValueError(f"expected a JSON object, got {type(record).__name__}")
except (OSError, ValueError) as exc: # ValueError: corrupt JSON and invalid UTF-8 alike
@@ -99,7 +99,7 @@ def _drain(root: Path) -> None:
records = sorted(_records(root), key=lambda item: item[1]["sequence"])
for path, _ in records:
with _FileLock(root / ".lock"):
- record = json.loads(path.read_text(encoding="utf-8"))
+ record = json.loads(path.read_text(encoding="utf-8-sig"))
if not isinstance(record, dict) or record["status"] != "queued":
continue
home = Path(record["home"])
diff --git a/cron/scheduler_diagnostics.py b/cron/scheduler_diagnostics.py
index c1dad472746..0954cb325b2 100644
--- a/cron/scheduler_diagnostics.py
+++ b/cron/scheduler_diagnostics.py
@@ -26,7 +26,7 @@ def external_worker_stderr_tail(path: Path) -> str:
Returns an empty string when nothing was captured.
"""
try:
- text = path.read_text(encoding="utf-8", errors="replace").strip()
+ text = path.read_text(encoding="utf-8-sig", errors="replace").strip()
except OSError:
return ""
if not text:
diff --git a/gateway/agent_cache_pressure.py b/gateway/agent_cache_pressure.py
index 2fcc188bc87..358e4385966 100644
--- a/gateway/agent_cache_pressure.py
+++ b/gateway/agent_cache_pressure.py
@@ -159,7 +159,7 @@ def _cgroup_anon_bytes() -> Optional[int]:
return None
root = Path(f"/sys/fs/cgroup{own}")
capped = any(_finite_limit(root / f"memory.{f}") for f in ("high", "max"))
- text = root.joinpath("memory.stat").read_text(encoding="utf-8") if capped else ""
+ text = root.joinpath("memory.stat").read_text(encoding="utf-8-sig") if capped else ""
except (OSError, ValueError, ImportError):
return None
for line in text.splitlines():
diff --git a/gateway/run.py b/gateway/run.py
index a4836197c26..2b006bab9a1 100644
--- a/gateway/run.py
+++ b/gateway/run.py
@@ -2718,7 +2718,7 @@ def _skill_slug_from_frontmatter(skill_md: Path) -> tuple[str | None, str | None
"""Derive ``(slug, declared_name)`` from a SKILL.md; ``(None, None)`` if unreadable or no ``name:``.
Matches ``scan_skill_commands``: the slug comes from frontmatter ``name:``, NOT the directory."""
try:
- content = skill_md.read_text(encoding="utf-8", errors="replace")
+ content = skill_md.read_text(encoding="utf-8-sig", errors="replace")
except Exception:
return None, None
content = content.lstrip("\ufeff") # tolerate UTF-8 BOM (Windows editors)
@@ -5475,7 +5475,7 @@ def main():
config = None
if args.config:
import hermes_yaml as yaml
- with open(args.config, encoding="utf-8") as f:
+ with open(args.config, encoding="utf-8-sig") as f:
config = GatewayConfig.from_dict(yaml.safe_load(f) or {})
# Same boot-time verdict the loaded config gets when the file leaves the flag unset.
from hermes_cli.gateway_multiplex_mode import log_multiplex_decision, resolve_multiplex_mode
diff --git a/gateway/run_notifications.py b/gateway/run_notifications.py
index 7685cc36f22..7056366efde 100644
--- a/gateway/run_notifications.py
+++ b/gateway/run_notifications.py
@@ -836,7 +836,7 @@ class GatewayNotificationsMixin:
if not path.exists():
return
try:
- data = json.loads(path.read_text(encoding="utf-8"))
+ data = json.loads(path.read_text(encoding="utf-8-sig"))
delivered = {tuple(target) for target in data.get("delivered_targets", [])}
# Owed targets come from config, not live transports: a removed home or an opt-out
# (gateway_restart_notification=false) must not keep the marker alive forever.
diff --git a/hermes_cli/agent_import_sync.py b/hermes_cli/agent_import_sync.py
index 3d5f1eab54b..8cf7c38474a 100644
--- a/hermes_cli/agent_import_sync.py
+++ b/hermes_cli/agent_import_sync.py
@@ -87,7 +87,7 @@ def load_sync_manifest(target_root: Path) -> Dict[str, Any]:
if not path.exists():
return {"version": 1, "agents": {}}
try:
- data = json.loads(path.read_text(encoding="utf-8", errors="replace"))
+ data = json.loads(path.read_text(encoding="utf-8-sig", errors="replace"))
except (json.JSONDecodeError, OSError):
logger.warning("Unreadable %s — starting a fresh sync manifest", path)
return {"version": 1, "agents": {}}
diff --git a/hermes_cli/config_effective.py b/hermes_cli/config_effective.py
index 3f1ff8a433b..8800bfe1d5c 100644
--- a/hermes_cli/config_effective.py
+++ b/hermes_cli/config_effective.py
@@ -77,7 +77,7 @@ def load_user_config_effective(config_path: Optional[Path] = None, *, fail_close
_LAST_GOOD_USER_RAW.setdefault(path_key, copy.deepcopy(raw))
elif user_sig is not None:
try:
- with open(config_path, encoding="utf-8") as f:
+ with open(config_path, encoding="utf-8-sig") as f:
loaded = fast_safe_load(f)
except Exception as exc:
if fail_closed:
diff --git a/hermes_cli/env_loader.py b/hermes_cli/env_loader.py
index 887baeb357d..40fad27a894 100644
--- a/hermes_cli/env_loader.py
+++ b/hermes_cli/env_loader.py
@@ -607,7 +607,7 @@ def _load_secrets_config(home_path: Path) -> dict:
except Exception:
pass
try:
- with open(config_path, "r", encoding="utf-8") as f:
+ with open(config_path, "r", encoding="utf-8-sig") as f:
data = fast_safe_load(f) or {}
except Exception: # noqa: BLE001
return {}
diff --git a/hermes_cli/gateway_windows.py b/hermes_cli/gateway_windows.py
index 7a34788147b..7c589ab4fce 100644
--- a/hermes_cli/gateway_windows.py
+++ b/hermes_cli/gateway_windows.py
@@ -997,7 +997,7 @@ def _consume_start_attestation(generation: str, home: Path | None = None) -> Non
def _read_start_attestation(home: Path | None = None) -> object | None:
"""Parsed attestation payload (any JSON type), or ``None`` when absent/unreadable. Never raises."""
try:
- return json.loads(_start_attestation_path(home).read_text(encoding="utf-8"))
+ return json.loads(_start_attestation_path(home).read_text(encoding="utf-8-sig"))
except (OSError, ValueError):
return None
@@ -1032,7 +1032,7 @@ def _attested_pid_exited_cleanly(pid: int, create_time: float | None = None, hom
from gateway.lifecycle_ledger import get_lifecycle_sentinel_path
sentinel = get_lifecycle_sentinel_path(home if home is not None else _hermes_home())
- data = json.loads(sentinel.read_text(encoding="utf-8"))
+ data = json.loads(sentinel.read_text(encoding="utf-8-sig"))
except OSError:
return False
except Exception:
@@ -1363,7 +1363,7 @@ def _probe_pid_file(pid_path: Path) -> int | None:
if _probe_missing(1, pid_path, "PID file"):
return None
try:
- data = json.loads(pid_path.read_text(encoding="utf-8"))
+ data = json.loads(pid_path.read_text(encoding="utf-8-sig"))
pid_value = int(data.get("pid")) if data.get("pid") is not None else None
_probe(1, True, f"PID file present: {pid_path} (pid={pid_value})")
return pid_value
@@ -1412,7 +1412,7 @@ def _probe_state_file(state_path: Path) -> None:
if _probe_missing(5, state_path, "gateway_state.json"):
return
try:
- state_data = json.loads(state_path.read_text(encoding="utf-8"))
+ state_data = json.loads(state_path.read_text(encoding="utf-8-sig"))
gateway_state = state_data.get("gateway_state")
updated_at = state_data.get("updated_at")
age_str = ""
diff --git a/hermes_cli/local_runtime/recovery.py b/hermes_cli/local_runtime/recovery.py
index 8e5d2c18f45..176d2ae6de2 100644
--- a/hermes_cli/local_runtime/recovery.py
+++ b/hermes_cli/local_runtime/recovery.py
@@ -16,7 +16,7 @@ def read_state() -> dict:
from hermes_cli.local_runtime.supervisor import state_path
try:
- state = json.loads(state_path().read_text(encoding="utf-8"))
+ state = json.loads(state_path().read_text(encoding="utf-8-sig"))
return state if isinstance(state, dict) else {}
except (OSError, ValueError):
return {}
@@ -131,7 +131,7 @@ def stop_recorded_orphan() -> bool:
from hermes_cli.local_runtime.supervisor import LlamaServerSupervisor, state_path
try:
- state = json.loads(state_path().read_text(encoding="utf-8"))
+ state = json.loads(state_path().read_text(encoding="utf-8-sig"))
except FileNotFoundError:
return True # already stopped and no record
except (OSError, ValueError):
diff --git a/hermes_cli/psutil_android.py b/hermes_cli/psutil_android.py
index 7ffefb00199..4bb0df83599 100644
--- a/hermes_cli/psutil_android.py
+++ b/hermes_cli/psutil_android.py
@@ -35,7 +35,7 @@ def prepare_patched_psutil_sdist(archive: Path, destination: Path) -> Path:
if not common_py.is_file():
raise PsutilAndroidInstallError(f"psutil sdist did not contain {rel!s}")
try:
- content = common_py.read_text(encoding="utf-8")
+ content = common_py.read_text(encoding="utf-8-sig")
except OSError as exc:
raise PsutilAndroidInstallError(f"Failed to read {rel!s}") from exc
if MARKER not in content:
diff --git a/hermes_cli/quiet_single_query.py b/hermes_cli/quiet_single_query.py
index 8088a1d7d34..0f36b413264 100644
--- a/hermes_cli/quiet_single_query.py
+++ b/hermes_cli/quiet_single_query.py
@@ -68,7 +68,7 @@ def write_turn_report(path: str | None, *, exit_code: int, error: str = "") -> N
def read_turn_report(path: str, pid: int) -> dict | None:
"""The child's turn report, or None while absent, unreadable, or written by another process."""
try:
- with open(path, encoding="utf-8") as fh:
+ with open(path, encoding="utf-8-sig") as fh:
record = json.load(fh)
except (OSError, ValueError):
return None
diff --git a/hermes_cli/status_bar_git.py b/hermes_cli/status_bar_git.py
index f3321524aa9..a25c6cd5cf8 100644
--- a/hermes_cli/status_bar_git.py
+++ b/hermes_cli/status_bar_git.py
@@ -24,7 +24,7 @@ def _resolve_git_dir(start: Path) -> Optional[Path]:
return dotgit
if dotgit.is_file():
try:
- line = dotgit.read_text(encoding="utf-8", errors="replace").strip()
+ line = dotgit.read_text(encoding="utf-8-sig", errors="replace").strip()
except OSError:
return None
if line.startswith("gitdir:"):
@@ -53,7 +53,7 @@ def current_git_branch(cwd: Optional[str] = None) -> str:
git_dir = _resolve_git_dir(base)
if git_dir is not None:
try:
- head = (git_dir / "HEAD").read_text(encoding="utf-8", errors="replace").strip()
+ head = (git_dir / "HEAD").read_text(encoding="utf-8-sig", errors="replace").strip()
except OSError:
head = ""
if head.startswith("ref:"):
diff --git a/hermes_cli/update_cmd_fleet.py b/hermes_cli/update_cmd_fleet.py
index c03d74b4322..6de15fcade8 100644
--- a/hermes_cli/update_cmd_fleet.py
+++ b/hermes_cli/update_cmd_fleet.py
@@ -221,7 +221,7 @@ def _marker_only_restart_obsolete() -> bool:
try:
fields = {}
- for line in _fleet_restart_pending_marker_path().read_text(encoding="utf-8").splitlines():
+ for line in _fleet_restart_pending_marker_path().read_text(encoding="utf-8-sig").splitlines():
key, value = line.split("=", 1)
if key in fields:
return False
diff --git a/hermes_cli/update_cmd_git.py b/hermes_cli/update_cmd_git.py
index e377e55fb08..7cb9fcb4d3f 100644
--- a/hermes_cli/update_cmd_git.py
+++ b/hermes_cli/update_cmd_git.py
@@ -444,7 +444,7 @@ def _npm_lockfile_owners(repo_root: Path) -> set[Path]:
owners = {Path(".")}
try:
import json
- package = json.loads((repo_root / "package.json").read_text(encoding="utf-8"))
+ package = json.loads((repo_root / "package.json").read_text(encoding="utf-8-sig"))
workspaces = package.get("workspaces", [])
if isinstance(workspaces, dict):
workspaces = workspaces.get("packages", [])
diff --git a/hermes_cli/update_handoff.py b/hermes_cli/update_handoff.py
index a7e48e07679..368d5eddc54 100644
--- a/hermes_cli/update_handoff.py
+++ b/hermes_cli/update_handoff.py
@@ -40,7 +40,7 @@ def write_handoff(payload: dict[str, Any]) -> Path:
def read_handoff(path: str | Path) -> dict[str, Any]:
- payload = json.loads(Path(path).read_text(encoding="utf-8"))
+ payload = json.loads(Path(path).read_text(encoding="utf-8-sig"))
if not isinstance(payload, dict):
raise ValueError(f"post-swap hand-off {path} is not a JSON object")
return payload
diff --git a/hermes_cli/update_serve_obligations.py b/hermes_cli/update_serve_obligations.py
index 3b513a5e16c..037abd43bd8 100644
--- a/hermes_cli/update_serve_obligations.py
+++ b/hermes_cli/update_serve_obligations.py
@@ -81,7 +81,7 @@ def warn_pending_manual_serves(*, startup: bool = False, pending_manual: list[di
directory = get_hermes_home() / "serve_restart_pending"
for path in sorted(directory.glob("*.json")):
try:
- row = json.loads(path.read_text(encoding="utf-8"))
+ row = json.loads(path.read_text(encoding="utf-8-sig"))
if _pid_alive_matches(row["pid"], row["create_time"]) is False:
path.unlink(missing_ok=True)
continue
diff --git a/hermes_cli/update_stage.py b/hermes_cli/update_stage.py
index fbbd3cfc556..0c09f61b845 100644
--- a/hermes_cli/update_stage.py
+++ b/hermes_cli/update_stage.py
@@ -115,7 +115,7 @@ def ensure_panel(update_root: Path) -> None:
try:
home = os.environ.get("HERMES_HOME") or str(Path.home() / ".hermes")
log = Path(home) / "logs" / "desktop-update-handoff.log"
- if log.is_file() and _ui_present_in_log(log.read_text(encoding="utf-8", errors="replace")[-8000:]):
+ if log.is_file() and _ui_present_in_log(log.read_text(encoding="utf-8-sig", errors="replace")[-8000:]):
return
import subprocess
diff --git a/hermes_cli/web_server_cron.py b/hermes_cli/web_server_cron.py
index 26dabeebff2..a7e319ee5be 100644
--- a/hermes_cli/web_server_cron.py
+++ b/hermes_cli/web_server_cron.py
@@ -415,7 +415,7 @@ def _gateway_intentionally_stopped(profile: Optional[str]) -> bool:
"""
import json as _json
try:
- data = _json.loads((_cron_profile_home(profile)[1] / "gateway_state.json").read_text(encoding="utf-8"))
+ data = _json.loads((_cron_profile_home(profile)[1] / "gateway_state.json").read_text(encoding="utf-8-sig"))
return isinstance(data, dict) and data.get("desired_state") == "stopped"
except Exception:
return False
diff --git a/plugins/memory/honcho/cli.py b/plugins/memory/honcho/cli.py
index b0b921c5e85..006c7c5bb60 100644
--- a/plugins/memory/honcho/cli.py
+++ b/plugins/memory/honcho/cli.py
@@ -1661,7 +1661,7 @@ Honcho identity management
p = Path(file_path).expanduser()
if not p.exists():
return print(f" File not found: {p}\n")
- content = p.read_text(encoding="utf-8").strip()
+ content = p.read_text(encoding="utf-8-sig").strip()
if not content:
return print(f" File is empty: {p}\n")
if mgr.seed_ai_identity(session_key, content, source=p.name):
@@ -1688,7 +1688,7 @@ def _migrate_upload(mgr, session_key: str, user_files: list[Path]) -> None:
def _migrate_seed(mgr, session_key: str, agent_files: list[Path]) -> None:
for f in agent_files:
- content = f.read_text(encoding="utf-8").strip()
+ content = f.read_text(encoding="utf-8-sig").strip()
if content:
ok = mgr.seed_ai_identity(session_key, content, source=f.name)
print(f" {f.name}: {'seeded' if ok else 'failed'}")
diff --git a/plugins/platforms/google_chat/oauth.py b/plugins/platforms/google_chat/oauth.py
index c445d9372c5..e4dcbc4c11f 100644
--- a/plugins/platforms/google_chat/oauth.py
+++ b/plugins/platforms/google_chat/oauth.py
@@ -272,7 +272,7 @@ def store_client_secret(path: str) -> None:
if not src.exists():
_fail(f"ERROR: File not found: {src}")
try:
- data = json.loads(src.read_text(encoding="utf-8"))
+ data = json.loads(src.read_text(encoding="utf-8-sig"))
except json.JSONDecodeError:
_fail("ERROR: File is not valid JSON.")
if "installed" not in data and "web" not in data:
@@ -296,7 +296,7 @@ def _load_pending_auth(email: Optional[str] = None) -> dict:
if not pending.exists():
_fail("ERROR: No pending OAuth session found. Run --auth-url first.")
try:
- data = json.loads(pending.read_text(encoding="utf-8"))
+ data = json.loads(pending.read_text(encoding="utf-8-sig"))
except Exception as exc:
_fail(f"ERROR: Could not read pending OAuth session: {exc}", "Run --auth-url again to start a fresh session.")
if not data.get("state") or not data.get("code_verifier"):
diff --git a/scripts/check_profile_scope_patterns.py b/scripts/check_profile_scope_patterns.py
index 79dbccfcad6..d7d41afcc4b 100644
--- a/scripts/check_profile_scope_patterns.py
+++ b/scripts/check_profile_scope_patterns.py
@@ -46,7 +46,7 @@ class Finding:
def load_patterns(path: Path = PATTERNS) -> list[dict]:
- data = json.loads(path.read_text(encoding="utf-8"))
+ data = json.loads(path.read_text(encoding="utf-8-sig"))
out = []
for p in data["patterns"]:
# ``path_regex`` (optional) restricts a pattern to files whose repo-relative path matches.
@@ -111,7 +111,7 @@ def _read(rel: str, head: str | None) -> str | None:
r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace")
return r.stdout if r.returncode == 0 else None
path = ROOT / rel
- return path.read_text(encoding="utf-8", errors="replace") if path.is_file() else None
+ return path.read_text(encoding="utf-8-sig", errors="replace") if path.is_file() else None
def run(base: str | None, head: str | None, files: list[str], patterns: list[dict]) -> list[Finding]:
@@ -119,7 +119,7 @@ def run(base: str | None, head: str | None, files: list[str], patterns: list[dic
if files:
for f in files:
path = Path(f)
- text = path.read_text(encoding="utf-8", errors="replace") if path.is_file() else None
+ text = path.read_text(encoding="utf-8-sig", errors="replace") if path.is_file() else None
if text is None:
continue
resolved = path.resolve()
diff --git a/scripts/ci/check_os_marker_fakes.py b/scripts/ci/check_os_marker_fakes.py
index 3b1d5988532..2f47802b1b3 100644
--- a/scripts/ci/check_os_marker_fakes.py
+++ b/scripts/ci/check_os_marker_fakes.py
@@ -84,7 +84,7 @@ def find_unmarked_fakes(root: Path, repo_root: Path) -> dict[str, list[tuple[int
continue
path = Path(dirpath) / fname
try:
- text = path.read_text(encoding="utf-8", errors="replace")
+ text = path.read_text(encoding="utf-8-sig", errors="replace")
except OSError:
continue
if marker_pat.search(text):
diff --git a/scripts/ci/list_os_marked_tests.py b/scripts/ci/list_os_marked_tests.py
index 5d41bf1c77c..5eeba0f99a9 100644
--- a/scripts/ci/list_os_marked_tests.py
+++ b/scripts/ci/list_os_marked_tests.py
@@ -55,7 +55,7 @@ def find_marked_files(platform: str, root: Path) -> list[Path]:
continue
path = Path(dirpath) / fname
try:
- text = path.read_text(encoding="utf-8", errors="replace")
+ text = path.read_text(encoding="utf-8-sig", errors="replace")
except OSError:
continue
if pattern.search(text):
diff --git a/scripts/dump_desktop_slash_registry.py b/scripts/dump_desktop_slash_registry.py
index 64fce646cda..903ba7b103d 100755
--- a/scripts/dump_desktop_slash_registry.py
+++ b/scripts/dump_desktop_slash_registry.py
@@ -27,7 +27,7 @@ def render() -> str:
def check(out: Path = OUT) -> int:
"""0 when ``out`` matches the registry byte-for-byte, else 1 with a hint on stderr."""
- committed = out.read_text(encoding="utf-8") if out.exists() else ""
+ committed = out.read_text(encoding="utf-8-sig") if out.exists() else ""
if committed == render():
return 0
rel = out.relative_to(ROOT) if out.is_relative_to(ROOT) else out
diff --git a/scripts/gen_gateway_contracts.py b/scripts/gen_gateway_contracts.py
index 476660cb663..f28f735b45c 100644
--- a/scripts/gen_gateway_contracts.py
+++ b/scripts/gen_gateway_contracts.py
@@ -298,7 +298,7 @@ def main(argv: list[str] | None = None) -> int:
check = "--check" in args
stale = []
for path, text in render_all().items():
- current = path.read_text(encoding="utf-8") if path.exists() else None
+ current = path.read_text(encoding="utf-8-sig") if path.exists() else None
if current == text:
continue
if check:
diff --git a/tools/bot_live_delivery.py b/tools/bot_live_delivery.py
index 36931646f8b..2335941d4ef 100644
--- a/tools/bot_live_delivery.py
+++ b/tools/bot_live_delivery.py
@@ -149,7 +149,7 @@ def _next_sequence(root: Path) -> int:
"""
counter = root / _SEQUENCE_FILE
try:
- persisted = int(counter.read_text(encoding="utf-8"))
+ persisted = int(counter.read_text(encoding="utf-8-sig"))
except (OSError, ValueError):
persisted = 0
scanned = max((record.get("sequence", record["created_at"])
diff --git a/tools/plugin_guard.py b/tools/plugin_guard.py
index 13702e67cc3..73ac212e9bf 100644
--- a/tools/plugin_guard.py
+++ b/tools/plugin_guard.py
@@ -142,7 +142,7 @@ def _main_guard_body_lines(file_path: Path) -> set[int]:
conservative severity.
"""
try:
- tree = ast.parse(file_path.read_text(encoding="utf-8"))
+ tree = ast.parse(file_path.read_text(encoding="utf-8-sig"))
except (OSError, SyntaxError, ValueError): # ValueError: UnicodeDecodeError, NUL bytes
return set()
lines: set[int] = set()
diff --git a/tools/voice_mode.py b/tools/voice_mode.py
index 72f48de2677..c2185342030 100644
--- a/tools/voice_mode.py
+++ b/tools/voice_mode.py
@@ -980,7 +980,7 @@ def _is_wsl2_env() -> bool:
"""True inside WSL (Microsoft kernel signature in /proc/version); False on any error.
Module-level so tests can patch it instead of ``builtins.open``."""
try:
- with open("/proc/version", encoding="utf-8", errors="replace") as _fv:
+ with open("/proc/version", encoding="utf-8-sig", errors="replace") as _fv:
return "microsoft" in _fv.read().lower()
except OSError:
return False