Skip to content

fix 10878: strip UTF-8 BOM from memory files on read - #11147

Closed
vominh1919 wants to merge 1 commit into
NousResearch:mainfrom
vominh1919:fix/10878-strip-bom
Closed

fix 10878: strip UTF-8 BOM from memory files on read#11147
vominh1919 wants to merge 1 commit into
NousResearch:mainfrom
vominh1919:fix/10878-strip-bom

Conversation

@vominh1919

Copy link
Copy Markdown
Contributor

Fixes #10878

MemoryStore._read_file() reads with encoding=utf-8 which does not auto-strip BOM. If MEMORY.md starts with BOM (common on Windows Notepad), the invisible character enters the system prompt.

Now strips BOM after reading if present.

MemoryStore._read_file() reads with encoding=utf-8 which does not
auto-strip BOM. If MEMORY.md starts with BOM (common on Windows
Notepad), the \ufeff character enters the system prompt.

Now strips BOM after reading if present.

Fixes NousResearch#10878
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Closing as duplicate of #10888 which addresses the same BOM issue more comprehensively. #10888 uses encoding="utf-8-sig" (auto-strips BOM via Python's codec) plus errors="replace" for non-UTF-8 bytes, while this PR only strips BOM manually without handling encoding errors. Thanks @vominh1919!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: memory_tool _read_file does not strip BOM — invisible \ufeff enters system prompt

2 participants