Skip to content

feat(fs): add encoding option to filesystem tools#258

Open
Johnsen Young (zhisenyang) wants to merge 7 commits intolangchain-ai:mainfrom
zhisenyang:feat/fs-encoding
Open

feat(fs): add encoding option to filesystem tools#258
Johnsen Young (zhisenyang) wants to merge 7 commits intolangchain-ai:mainfrom
zhisenyang:feat/fs-encoding

Conversation

@zhisenyang

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 28, 2026

🦋 Changeset detected

Latest commit: 79225ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
deepagents Minor
deepagents-acp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. Could we add a unit test that verifies that encoding works properly?

@zhisenyang
Copy link
Author

Changes look good to me. Could we add a unit test that verifies that encoding works properly?

👌

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more comments


// Verify raw file content on disk is actually utf-16le encoded
const diskContentRaw = await fs.readFile(file);
const decodedDiskContent = Buffer.from(diskContentRaw).toString(encoding);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use Buffer, instead TextDecoder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

});

const file = path.join(root, "encoding-test.txt");
const text = "Hello encoding with utf-16le";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we use a utf-16le encoding but a basic utf-8 text - I think we would get more confidence in the test if we also work with text that requires a different encoding

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! Sure, I’ll add a unit test to verify that the encoding works properly.

@zhisenyang
Copy link
Author

👌

@christian-bromann

Johnsen Young (@zhisenyang) mind addressing above comments?

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.

2 participants