From 7a4b905ddb64bdc92b7f9acf2ccde9bd84d7a6f3 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 4 Sep 2026 02:20:48 +0200 Subject: fix(node): pin utf-8 (and LF) on every text file the node reads or writes node.toml, the keystore envelope, the unlock key, the loopback UI token, pairing/invite code files and the denylist were all read and written with the platform default encoding and newline translation. On Windows that is cp1252 + CRLF: a node.toml or keystore holding any non-ASCII byte failed to load, and ops.py's line-based node.toml editor round-tripped CRLF in and LF out. Every read is now `encoding="utf-8"`; every write is `encoding="utf-8", newline="\n"` so the files stay LF whatever the OS. No-op where the locale was already UTF-8. Co-Authored-By: Claude Sonnet 5 --- packages/meshbay-node/src/meshbay_node/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/meshbay-node/src/meshbay_node/config.py') diff --git a/packages/meshbay-node/src/meshbay_node/config.py b/packages/meshbay-node/src/meshbay_node/config.py index cfbec50..7be68a4 100644 --- a/packages/meshbay-node/src/meshbay_node/config.py +++ b/packages/meshbay-node/src/meshbay_node/config.py @@ -307,7 +307,7 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config: cfg = Config() if path.exists(): - raw = tomllib.loads(path.read_text()) + raw = tomllib.loads(path.read_text(encoding="utf-8")) hub = raw.get("hub", {}) cfg.hub.url = hub.get("url", cfg.hub.url) @@ -404,4 +404,4 @@ def write_example_config(path: Path = DEFAULT_CONFIG_PATH) -> None: """Write an example config file if none exists.""" if not path.exists(): path.parent.mkdir(parents=True, exist_ok=True) - path.write_text(EXAMPLE_CONFIG) + path.write_text(EXAMPLE_CONFIG, encoding="utf-8", newline="\n") -- cgit v1.2.3