fix(files): honor Unicode byte-order marks
This commit is contained in:
1 parent
602efc3bc3
commit
394b4f2cc3
1 file changed
+4
@@ -348,6 +348,10 @@ class ReadFileTool(_FsTool):
|
||||
fp, offset=offset, limit=limit, content_hash=content_hash,
|
||||
):
|
||||
return f"[File unchanged since last read: {path}]"
|
||||
from nanobot.utils.document import _decode_bom_text
|
||||
|
||||
text_content = _decode_bom_text(raw)
|
||||
if text_content is None:
|
||||
try:
|
||||
text_content = raw.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
|
||||
Reference in new issue
Block a user