Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agentic-ide): search finds text in legacy-encoded files
rubenluetke10-beep9ab2a77440a1
diff --git a/jarvis/agentic_ide/file_search.py b/jarvis/agentic_ide/file_search.pyindex 03e09132d7..5bd291f28c 100644--- a/jarvis/agentic_ide/file_search.py+++ b/jarvis/agentic_ide/file_search.py@@ -24,6 +24,7 @@ from pathlib import Pathfrom .file_editing import (EditConflict,EditError,+ _decode,list_files,read_text_file,write_text_file,@@ -43,7 +44,6 @@ MAX_SEARCH_BYTES = 1024 * 1024#: Wall-clock budget for one search.SEARCH_BUDGET_S = 8.0_PREVIEW_CHARS = 240-_BINARY_SNIFF_BYTES = 8192@dataclass(frozen=True, slots=True)@@ -107,9 +107,10 @@ def _read_searchable(base: Path, path: str) -> str | None:data = target.read_bytes()except OSError:return None- if b"\x00" in data[:_BINARY_SNIFF_BYTES]:- return None- return data.decode("utf-8", errors="replace")+ # Read it exactly the way the editor opens it (UTF-8, UTF-16, Windows code+ # pages, …), so a search finds what the editor shows; binaries stay out.+ decoded = _decode(data)+ return decoded[0] if decoded else Nonedef _preview(line: str, start: int, end: int) -> tuple[str, int]:diff --git a/tests/unit/agentic_ide/test_file_search.py b/tests/unit/agentic_ide/test_file_search.pyindex d71b99e7b2..7f2d69bc39 100644--- a/tests/unit/agentic_ide/test_file_search.py+++ b/tests/unit/agentic_ide/test_file_search.py@@ -106,3 +106,17 @@ def test_replace_keeps_crlf_and_reports_unreadable_files(project: Path) -> None:answer = replace_in_files(project, SearchOptions("two"), "2", ["win.txt", "logo.bin"])assert (project / "win.txt").read_bytes() == b"one\r\n2\r\n"assert answer["skipped"] == [{"path": "logo.bin", "reason": "not a text file"}]+++def test_search_reads_legacy_encodings_like_the_editor(project: Path) -> None:+ (project / "legacy.txt").write_bytes(+ "Déjà vu: café crème, naïve façade.\r\n".encode("cp1252") * 3+ )++ hits = _hits(search_workspace(project, SearchOptions("façade")))++ assert [(path, line) for path, line, _ in hits] == [+ ("legacy.txt", 1),+ ("legacy.txt", 2),+ ("legacy.txt", 3),+ ]